-
-
Notifications
You must be signed in to change notification settings - Fork 252
/
makefile
49 lines (34 loc) · 1.24 KB
/
makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
.PHONY: install-devel check lint test check-clean-tree fix force-fix venv
# NOTE: ZT_VENV and BASEPYTHON are advanced undocumented features
# Customize your venv name by running make as "ZT_VENV=my_venv_name make <command>"
BASEPYTHON?=python3
ZT_VENV?=zt_venv
VENV_ACTIVATE=. $(ZT_VENV)/bin/activate
PYTHON=${ZT_VENV}/bin/$(BASEPYTHON)
SOURCES = zulipterminal tests setup.py
# Default target at top
install-devel: venv
### LINT/TEST FILES ###
check: lint test
lint: venv
@tools/lint-all
test: venv
@pytest
### FIX FILES ###
check-clean-tree:
@git diff --exit-code --quiet || (echo 'Tree is not clean - commit changes in git first' && false)
fix: check-clean-tree
@make force-fix
force-fix: venv
@echo "=== Auto-fixing files ==="
isort $(SOURCES) tools
black zulipterminal/ tests/
ruff --fix $(SOURCES)
### VENV SETUP ###
# Short name for file dependency
venv: $(ZT_VENV)/bin/activate
# If setup.py is updated or activate script doesn't exist, update virtual env
$(ZT_VENV)/bin/activate: setup.py
@echo "=== Installing development environment ==="
test -d $(ZT_VENV) || $(BASEPYTHON) -m venv $(ZT_VENV)
$(PYTHON) -m pip install wheel && $(PYTHON) -m pip install -U pip && $(PYTHON) -m pip install -e .[dev] && touch $(ZT_VENV)/bin/activate