-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
102 lines (82 loc) · 3 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
.PHONY: clean clean-build clean-pyc clean-tests clean-log clean-docs api-docs docs lint checkmanifest test test-all cover sdist bdist build release
# Aliased calls for finding files and directories recursively
rwildcard = $(wildcard $1$2) $(foreach d,$(wildcard $1*),$(call rwildcard,$d/,$2))
rrmdir = $(foreach dir,$1,$(RM) -r $(dir))
rrmfile = $(foreach fname,$1,$(RM) $(fname))
# Set base variables
ROOT_DIRECTORY = $(dir $(realpath $(firstword $(MAKEFILE_LIST))))
BUILDDIR = build
DISTDIR = dist
TOXDIR = .tox
COVERAGEDIR = coverage
COVERAGEFILE = .coverage
EGGDIR = .eggs
CACHEDIR = .cache
PYPI_URL = https://pypi.python.org/pypi
help:
@echo "clean - runs clean-build, clean-pyc, clean-tests and clean-log"
@echo "clean-build - remove build artifacts"
@echo "clean-pyc - remove Python file artifacts"
@echo "clean-tests - remove test files"
@echo "clean-log - remove log files"
@echo "clean-docs - remove generated docs"
@echo "api-docs - generate the api documentation files"
@echo "docs - generate Sphinx HTML documentation, including API docs"
@echo "lint - check style with flake8"
@echo "checkmanifest - ensure the MANIFEST.in file is up to date"
@echo "test - run tests quickly with the default Python"
@echo "test-all - run tests on every Python version with tox"
@echo "cover - check code coverage quickly with the default Python"
@echo "sdist - build an sdist package"
@echo "bdist - build a bdist_wheel package"
@echo "build - build the sdist and bdist_wheel packages"
@echo "release - package and upload a release"
clean: clean-build clean-tests clean-pyc clean-log clean-docs
clean-build:
$(RM) -r $(BUILDDIR)
$(RM) -r $(DISTDIR)
$(call rrmdir,$(call rwildcard,$(ROOT_DIRECTORY),*.egg-info))
clean-tests:
$(RM) -r $(TOXDIR)
$(RM) -r $(COVERAGEDIR)
$(RM) $(COVERAGEFILE)
$(RM) -r $(EGGDIR)
$(RM) -r $(CACHEDIR)
clean-pyc:
$(call rrmdir,$(call rwildcard,$(ROOT_DIRECTORY),__pycache__))
$(call rrmfile,$(call rwildcard,$(ROOT_DIRECTORY),*.pyc))
$(call rrmfile,$(call rwildcard,$(ROOT_DIRECTORY),*.pyo))
$(call rrmfile,$(call rwildcard,$(ROOT_DIRECTORY),*~))
clean-log:
$(call rrmfile,$(call rwildcard,$(ROOT_DIRECTORY),*.log))
clean-docs:
$(MAKE) -C docs clean
$(RM) -r docs/api
api-docs: clean-docs
sphinx-apidoc -e -f -o docs/api markdownclerk
docs: api-docs
$(MAKE) -C docs html
lint:
flake8 markdownclerk
pylint markdownclerk
checkmanifest:
check-manifest
test:
env PYTHONPATH=$(ROOT_DIRECTORY):$(ROOT_DIRECTORY)tests py.test -vvv --showlocals --tb=long
test-all:
tox
cover:
env PYTHONPATH=$(ROOT_DIRECTORY):$(ROOT_DIRECTORY)tests py.test -vvv --cov --cov-report=term-missing --cov-report=xml --cov-report=html
sdist: clean api-docs checkmanifest
python setup.py sdist
ls -l dist
bdist: clean api-docs checkmanifest
python setup.py bdist_wheel
ls -l dist
build: clean api-docs checkmanifest
python setup.py sdist
python setup.py bdist_wheel
ls -l dist
release: clean api-docs checkmanifest
python setup.py sdist upload -r $(PYPI_URL)
python setup.py bdist_wheel upload -r $(PYPI_URL)