-
Notifications
You must be signed in to change notification settings - Fork 11
/
Makefile
70 lines (55 loc) · 1.29 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# This Makefile requires the following commands to be available:
# * python3.7
SRC:=fqn_decorators tests setup.py
.PHONY: pyclean
pyclean:
-find . -name "*.pyc" -delete
-rm -rf *.egg-info build
-rm -rf coverage*.xml .coverage
.PHONY: clean
clean: pyclean
-rm -rf venv
-rm -rf .tox
venv: PYTHON?=python3.7
venv:
$(PYTHON) -m venv venv
venv/bin/pip install -U "pip>=7.0" -q
venv/bin/pip install -U setuptools -q
venv/bin/pip install -r requirements.txt
## Code style
.PHONY: lint
lint: lint/black lint/flake8 lint/isort lint/mypy
.PHONY: lint/black
lint/black: venv
venv/bin/black --diff --check $(SRC)
.PHONY: lint/flake8
lint/flake8: venv
venv/bin/flake8 $(SRC)
.PHONY: lint/isort
lint/isort: venv
venv/bin/isort --diff --check $(SRC)
.PHONY: lint/mypy
lint/mypy: venv
venv/bin/mypy $(SRC)
.PHONY: format
format: format/isort format/black
.PHONY: format/isort
format/isort: venv
venv/bin/isort $(SRC)
.PHONY: format/black
format/black: venv
venv/bin/black $(SRC)
## Tests
.PHONY: unittests
unittests: TOX_ENV?=ALL
unittests: TOX_EXTRA_PARAMS?=""
unittests: venv
venv/bin/tox -e $(TOX_ENV) $(TOX_EXTRA_PARAMS)
.PHONY: test
test: pyclean venv unittests
## Distribution
.PHONY: build
build: venv
-rm -rf dist build
venv/bin/python setup.py sdist bdist_wheel
venv/bin/twine check dist/*