-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
111 lines (79 loc) · 2.27 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# A sample Makefile for facilitating development on Cfg-Loader.
# Python version
INTERPRETER=python3.6
# Python executable path
VENV=venv
VENV_BIN=$(VENV)/bin
export EXEC_PATH=$(VENV_BIN)/
# Python executables
PYTHON=$(EXEC_PATH)python
PIP=$(EXEC_PATH)pip
COVERAGE=$(EXEC_PATH)coverage
FLAKE8=$(EXEC_PATH)flake8
AUTOFLAKE=$(EXEC_PATH)autoflake
AUTOPEP8=$(EXEC_PATH)autopep8
PYTEST=$(EXEC_PATH)pytest
TOX=$(EXEC_PATH)tox
# General commands
.PHONY: all venv pip-install init develop
# Docs commands
.PHONY: build-docs docs
# Clean commands
.PHONY: clean-docs clean-pyc clean-build clean-tox clean hard-clean
# Linting commands
.PHONY: flake8 autoflake autopep8 auto-lint lint
# Test commands
.PHONY: test-lint test run-coverage coverage tox
venv:
@echo "Creating venv"
@virtualenv $(VENV) -p $(INTERPRETER)
install-dev:
@$(PIP) install -q -e .[dev]
develop: clean-pyc install-dev
init: venv develop
build-docs:
@$(MAKE) -sC docs build-html
docs:
@$(MAKE) -sC docs html
clean-docs:
@$(MAKE) -sC docs clean
@rm --force --recursive htmlcov/
clean-pyc:
@find . -name '*.pyc' -exec rm --force {} +
@find . -name '*.pyo' -exec rm -f {} +
@find . -name '__pycache__' -type d | xargs rm -rf
clean-build:
@rm --force --recursive build/
@rm --force --recursive dist/
@rm --force --recursive *.egg-info
clean-tox:
@rm --force --recursive .tox/
clean: clean-pyc clean-build clean-docs
hard-clean: clean-pyc clean-build clean-docs clean-tox
@rm --force --recursive .cache/
@rm --force --recursive venv/
@rm --force .coverage
@find . -name '.coverage.*' -exec rm -f {} +
flake8:
@$(FLAKE8)
test-lint: develop flake8
autoflake:
@$(AUTOFLAKE) -ir --remove-all-unused-imports --remove-unused-variables ./cfg_loader
@$(AUTOFLAKE) -ir --remove-all-unused-imports --remove-unused-variables ./tests
autopep8:
@$(AUTOPEP8) -ir --aggressive --max-line-length=120 ./cfg_loader
@$(AUTOPEP8) -ir --aggressive --max-line-length=120 ./tests
auto-lint: autoflake autopep8
lint: develop auto-lint
pytest:
@$(PYTEST) --doctest-modules --doctest-glob='*.rst'
test: develop pytest
run-coverage:
@$(COVERAGE) run -m pytest --doctest-modules --doctest-glob='*.rst'
@$(COVERAGE) report
@$(COVERAGE) html
coverage: develop run-coverage
@xdg-open htmlcov/index.html
test-all:
@$(TOX)
tox: develop test-all