-
Notifications
You must be signed in to change notification settings - Fork 11
/
Makefile
86 lines (69 loc) · 2.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
# Makefile for building releases of swagger-conformance.
# Source directories.
PKGSOURCEDIR = swaggerconformance
# General documentation directories.
DOCSSOURCEDIR = docs/source
SPHINXAPIOUT = $(DOCSSOURCEDIR)/modules
DOCSBUILDDIR = docs/build
DOCSHTMLDIR = $(DOCSBUILDDIR)/html
# Sphinx documentation commands.
SPHINXBUILDOPTS = -E -W
SPHINXBUILD = sphinx-build
SPHINXBUILDTARGET = html
# Python commands.
PYTHONCMD = python3
PYTHONUTDIR = tests
PYTHONUTOPTS = -v -s $(PYTHONUTDIR) -t . -p "test_*.py"
PYCOVERAGECMD = coverage
# Package building values.
DISTSDIR = dist
# Put it first so that "make" without argument is like "make help".
help:
@echo "Available targets:"
@echo " help"
@echo " Print this message."
@echo " lint"
@echo " Run pylint over the package's source code."
@echo " test"
@echo " Run all tests."
@echo " test_coverage"
@echo " Run all tests with code coverage enabled."
@echo " docs"
@echo " Generate all documentation."
@echo " package"
@echo " Package up ready for upload to PyPI."
@echo " all"
@echo " Run all tests and builds, but don't upload the results."
@echo " docs_upload"
@echo " Generate and upload documentation to PyPI."
@echo " package_upload"
@echo " Build and upload the current code to PyPI."
@echo " publish"
@echo " Build and publish docs and packages to PyPI."
# The version number is duplicated in two places - this check makes sure they
# are kept in sync.
version_check:
@[ "$$(sed -n 's/version = //p' docs/source/conf.py)" = \
"$$(sed -n 's/VERSION = //p' setup.py)" ]
lint:
$(PYTHONCMD) -m pylint $(PKGSOURCEDIR)
test: lint version_check
$(PYTHONCMD) -m unittest discover $(PYTHONUTOPTS)
test_coverage: test
$(PYCOVERAGECMD) run -m unittest discover $(PYTHONUTOPTS)
$(PYCOVERAGECMD) report
docs_clean:
rm -rf "$(DOCSBUILDDIR)"
docs_sphinx: docs_clean
@$(SPHINXBUILD) -M "$(SPHINXBUILDTARGET)" "$(DOCSSOURCEDIR)" \
"$(DOCSBUILDDIR)" $(SPHINXBUILDOPTS)
docs: docs_sphinx
package: test
rm -rf "$(DISTSDIR)"
$(PYTHONCMD) setup.py sdist bdist_wheel
package_upload: package
twine upload dist/*
publish: package_upload
all: docs test_coverage package
.PHONY: help lint test test_coverage docs_clean docs_sphinx docs package \
package_upload publish all