-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
34 lines (22 loc) · 853 Bytes
/
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
BLACK=cblack
PYTHON:=python3
PYLINT:=pylint
VERBOSE:=0
SOURCES=$(wildcard src/piston/*.py)
TESTS=$(wildcard tests/*.py)
VERBOSE_FLAG=$(if $(shell test $(VERBOSE) -gt 0 && echo 1),--verbose)
PY=PYTHONPATH=src $(PYTHON)
check: check/black check-docstring check-unit lint
check/black:
$(BLACK) --line-length 80 $$(find . -name *.py)
check-docstring: $(patsubst %.py,%.status,$(SOURCES)) README.status
check-unit: $(patsubst %.py,%.status,$(TESTS))
lint: $(patsubst %.py,%.lint,$(SOURCES))
tests/%.status: tests/%.py $(SOURCES)
$(PY) -m unittest $< && echo "$$?" > $@
%.status: %.py $(SOURCES) doctest-wrapper.py
$(PY) doctest-wrapper.py $< && echo "$$?" > $@
README.status: README.md $(SOURCES) doctest-wrapper.py
$(PY) doctest-wrapper.py $< && echo "$$?" > $@
%.lint: %.py
$(PYLINT) --rcfile lint.rc $(VERBOSE_FLAG) $< && echo "$$?" > $@