3
3
4
4
# Makefile for utility work on coverage.py.
5
5
6
- help : # # Show this help.
7
- @echo " Available targets:"
8
- @grep ' ^[a-zA-Z]' $(MAKEFILE_LIST ) | sort | awk -F ' :.*?## ' ' NF==2 {printf " %-26s%s\n", $$1, $$2}'
6
+ .DEFAULT_GOAL := help
7
+
8
+ # #@ Utilities
9
+
10
+ .PHONY : help clean_platform clean sterile
9
11
10
- clean_platform : # # Remove files that clash across platforms.
12
+ clean_platform :
11
13
@rm -f * .so * /* .so
12
14
@rm -rf __pycache__ * /__pycache__ * /* /__pycache__ * /* /* /__pycache__ * /* /* /* /__pycache__ * /* /* /* /* /__pycache__
13
15
@rm -f * .pyc * /* .pyc * /* /* .pyc * /* /* /* .pyc * /* /* /* /* .pyc * /* /* /* /* /* .pyc
14
16
@rm -f * .pyo * /* .pyo * /* /* .pyo * /* /* /* .pyo * /* /* /* /* .pyo * /* /* /* /* /* .pyo
15
17
16
- clean : clean_platform # # Remove artifacts of test execution, installation, etc.
18
+ clean : clean_platform # # Remove artifacts of test execution, installation, etc.
17
19
@echo " Cleaning..."
18
20
@-pip uninstall -yq coverage
19
21
@rm -f * .pyd * /* .pyd
@@ -32,28 +34,31 @@ clean: clean_platform ## Remove artifacts of test execution, i
32
34
@rm -rf tests/actual
33
35
@-make -C tests/gold/html clean
34
36
35
- sterile : clean # # Remove all non-controlled content, even if expensive.
37
+ sterile : clean # # Remove all non-controlled content, even if expensive.
36
38
rm -rf .tox
37
39
40
+ help : # # Show this help.
41
+ @# Adapted from https://www.thapaliya.com/en/writings/well-documented-makefiles/
42
+ @echo Available targets:
43
+ @awk ' BEGIN{FS=":.*##";} /^[^: ]+:.*##/{printf " \033[1m%-20s\033[m %s\n",$$1,$$2} /^##@/{printf "\n%s\n",substr($$0,5)}' $(MAKEFILE_LIST )
38
44
39
- CSS = coverage/htmlfiles/style.css
40
- SCSS = coverage/htmlfiles/style.scss
45
+ # #@ Tests and quality checks
41
46
42
- css : $(CSS ) # # Compile .scss into .css.
43
- $(CSS ) : $(SCSS )
44
- pysassc --style=compact $(SCSS ) $@
45
- cp $@ tests/gold/html/styled
47
+ .PHONY : lint smoke
46
48
47
49
lint : # # Run linters and checkers.
48
50
tox -q -e lint
49
51
50
52
PYTEST_SMOKE_ARGS = -n auto -m "not expensive" --maxfail=3 $(ARGS )
51
53
52
54
smoke : # # Run tests quickly with the C tracer in the lowest supported Python versions.
53
- COVERAGE_NO_PYTRACER=1 tox -q -e py36 -- $(PYTEST_SMOKE_ARGS )
55
+ COVERAGE_NO_PYTRACER=1 tox -q -e py37 -- $(PYTEST_SMOKE_ARGS )
56
+
54
57
55
- # Coverage measurement of coverage.py itself (meta-coverage). See metacov.ini
56
- # for details.
58
+ # #@ Metacov: coverage measurement of coverage.py itself
59
+ # See metacov.ini for details.
60
+
61
+ .PHONY : metacov metahtml metasmoke
57
62
58
63
metacov : # # Run meta-coverage, measuring ourself.
59
64
COVERAGE_COVERAGE=yes tox -q $(ARGS )
@@ -64,9 +69,14 @@ metahtml: ## Produce meta-coverage HTML reports.
64
69
metasmoke :
65
70
COVERAGE_NO_PYTRACER=1 ARGS=" -e py39" make metacov metahtml
66
71
72
+
73
+ # #@ Requirements management
74
+
75
+ .PHONY : upgrade
76
+
67
77
PIP_COMPILE = pip-compile --upgrade --allow-unsafe
68
78
upgrade : export CUSTOM_COMPILE_COMMAND=make upgrade
69
- upgrade : # # update the *.pip files with the latest packages satisfying *.in files
79
+ upgrade : # # Update the *.pip files with the latest packages satisfying *.in files.
70
80
pip install -q -r requirements/pip-tools.pip
71
81
$(PIP_COMPILE ) -o requirements/pip-tools.pip requirements/pip-tools.in
72
82
$(PIP_COMPILE ) -o requirements/pip.pip requirements/pip.in
@@ -77,10 +87,28 @@ upgrade: ## update the *.pip files with the latest packages satisfying *.in
77
87
$(PIP_COMPILE ) -o requirements/light-threads.pip requirements/light-threads.in
78
88
$(PIP_COMPILE ) -o doc/requirements.pip doc/requirements.in
79
89
90
+
91
+ # #@ Pre-builds for prepping the code
92
+
93
+ .PHONY : css workflows prebuild
94
+
95
+ CSS = coverage/htmlfiles/style.css
96
+ SCSS = coverage/htmlfiles/style.scss
97
+
98
+ css : $(CSS ) # # Compile .scss into .css.
99
+ $(CSS ) : $(SCSS )
100
+ pysassc --style=compact $(SCSS ) $@
101
+ cp $@ tests/gold/html/styled
102
+
80
103
workflows : # # Run cog on the workflows to keep them up-to-date.
81
104
python -m cogapp -crP .github/workflows/* .yml
82
105
83
- # Kitting
106
+ prebuild : css workflows cogdoc # # One command for all source prep.
107
+
108
+
109
+ # #@ Kitting: making releases
110
+
111
+ .PHONY : kit kit_upload test_upload kit_local download_kits check_kits
84
112
85
113
kit : # # Make the source distribution.
86
114
python -m build
@@ -106,10 +134,10 @@ download_kits: ## Download the built kits from GitHub.
106
134
check_kits : # # Check that dist/* are well-formed.
107
135
python -m twine check dist/*
108
136
109
- build_ext :
110
- python setup.py build_ext
111
137
112
- # Documentation
138
+ # #@ Documentation
139
+
140
+ .PHONY : cogdoc dochtml docdev docspell
113
141
114
142
DOCBIN = .tox/doc/bin
115
143
SPHINXOPTS = -aE
@@ -122,7 +150,7 @@ WEBSAMPLEBETA = $(WEBHOME)/files/sample_coverage_html_beta
122
150
$(DOCBIN ) :
123
151
tox -q -e doc --notest
124
152
125
- cogdoc : $(DOCBIN ) # # Run docs through cog
153
+ cogdoc : $(DOCBIN ) # # Run docs through cog.
126
154
$(DOCBIN ) /python -m cogapp -crP --verbosity=1 doc/* .rst
127
155
128
156
dochtml : cogdoc $(DOCBIN ) # # Build the docs HTML output.
@@ -134,7 +162,12 @@ docdev: dochtml ## Build docs, and auto-watch for changes.
134
162
docspell : $(DOCBIN ) # # Run the spell checker on the docs.
135
163
$(SPHINXBUILD ) -b spelling doc doc/_spell
136
164
137
- publish :
165
+
166
+ # #@ Publishing docs
167
+
168
+ .PHONY : publish publishbeta relnotes_json github_releases
169
+
170
+ publish : # # Publish the sample HTML report.
138
171
rm -f $(WEBSAMPLE ) /* .*
139
172
mkdir -p $(WEBSAMPLE )
140
173
cp doc/sample_html/* .* $(WEBSAMPLE )
0 commit comments