-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
84 lines (69 loc) · 1.7 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
VIRTUAL_ENV?=.venv
PYTHON?=$(VIRTUAL_ENV)/bin/python
PIP?=$(VIRTUAL_ENV)/bin/pip
COVERAGE?=$(VIRTUAL_ENV)/bin/coverage
FALKE8?=$(VIRTUAL_ENV)/bin/flake8
ISORT?=$(VIRTUAL_ENV)/bin/isort
WATCHMEDO=$(VIRTUAL_ENV)/bin/watchmedo
BROWSER?=firefox
PACKAGE?=chordchart_notation
help:
@## Displays this message
@echo -e "Usage:\n"
@awk ' \
/^[a-zA-Z_-]+:/ { \
t = $$0; \
sub(/:.*/, "", t) \
} \
/^\s+@?##/ { \
h = $$0; \
sub(/^\s*@*##/, "", h); \
print "\t" t "\t" h; \
t = "" \
} \
' Makefile | column -t -s $$'\t'
venv: $(PYTHON)
$(PYTHON):
python -m venv $(VIRTUAL_ENV)
testing-requirements: venv
$(PIP) install ".[testing]"
develop-requirements: venv
$(PIP) install -e ".[develop]"
develop: testing-requirements develop-requirements
@## Install in developpent mode
$(PYTHON) setup.py develop
typecheck:
@## Run the tests
$(PYTHON) -m mypy $(PACKAGE)
test:
@## Run the tests
$(PYTHON) -m unittest
lint:
@## Run lint tests
$(FALKE8) $(PACKAGE) tests
watch: COMMAND = $(MAKE) $(filter-out watch, $(MAKECMDGOALS))
watch:
@## Run command on source changes
$(WATCHMEDO) shell-command -R -W -p '*.py' -c '$(COMMAND)'
isort:
@## Sort python imports
$(ISORT) --recursive $(PACKAGE) tests setup.py
coverage:
@## Show coverage in the console
$(COVERAGE) run -m unittest
$(COVERAGE) report -m
coverage-html:
@## Show coverage in the browser
$(COVERAGE) run -m unittest
$(COVERAGE) html
$(BROWSER) htmlcov/index.html
clean-coverage:
@## Remove coverage files
rm -rf .coverage htmlcov
clean-pyc:
@## Remove python cache files
find -name '__pycache__' | xargs rm -rf {}
find -name '*.pyc' -exec rm -f {} \;
clean: clean-coverage clean-pyc
@## Remove intermediate files
rm -rf *.egg-info