-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
58 lines (45 loc) · 1.71 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
# SPDX-License-Identifier: GPL-2.0-only
# SPDX-FileCopyrightText: Copyright (C) 2024 Stefan Lengfeld
all:
.PHONY: tests
tests: ### Runs the python unit tests
python3 -m unittest discover -s tests
@# Also test executing the scripts by hand
tests/test_lib.py
tests/test_prog.py
tests/test_submodule.py
cd tests && ./test_lib.py && ./test_prog.py && ./test_submodule.py
# The file website/index.md is nearly a one-to-one copy of the README.md file.
# But there are some differences for links and text. This check should verify
# that both files are in sync expect the expected references.
.PHONY: check-index-md
check-index-md:
@# NOTE: "git diff" returns with 1 if there are changes. And changes are expected
git diff --no-index README.md website/index.md > index.md.diff || true
diff index.md.diff tests/index.md.diff
rm index.md.diff
@echo Everything is fine!
# For now just hook this up to the "lint" target.
lint: check-index-md
# for README.md, TODO.md and CHANGELOG.md
%.html: %.md
pandoc --toc -s $< > $@
.PHONY: lint
lint: ### Runs the pycodestyle on source code
@# The default line length 79 is too limited for modern use.
@# I don't have 80 column terminals anymore.
pycodestyle *.py tests/*.py --max-line-length=100
.PHONY: dist
dist:
rm -rf dist
python3 -m build
.PHONY: clean
clean:
rm -rf dist
# Clean left over temp directories. Can happen when the test scripts
# crash.
find tests/ -maxdepth 1 -type d -name "Test*" -exec rm -fr "{}" \;
# see http://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
.PHONY: help
help: ## Show the help prompt
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'