@@ -6,21 +6,36 @@ LANG = en_US.UTF-8
66MAKE = make
77PY = python3
88RM = rm -rf
9+ GIT = git
10+ OPEN = xdg-open
911
10- # Build sphinx documentation.
1112.PHONY : docs
1213docs :
1314 $(MAKE ) -C docs/
1415
15- # Run unittest.
16+ .PHONY :
17+ view :
18+ $(OPEN ) docs/_build/html/index.html
19+
20+ .PHONY : clean
21+ clean :
22+ $(MAKE ) -C docs/ clean; $(RM ) dist/
23+
24+ .PHONY : fmt
25+ fmt :
26+ ruff format src/ && ruff check --fix src/
27+
1628.PHONY : test
1729test :
1830 $(PY ) -m unittest discover -s tests -v
1931
32+ # ###############################################################################
33+ # Distribution Package
34+ # ###############################################################################
35+
2036# Build distribution package, for "install" or "upload".
2137.PHONY : dist
22- dist : pyproject.toml
23- $(RM ) dist/ # clean up old dist
38+ dist : pyproject.toml clean
2439 $(PY ) -m build
2540
2641# Install distribution package to user directory.
@@ -39,20 +54,37 @@ install: dist
3954upload : dist
4055 $(PY ) -m twine upload --repository pypi $< /*
4156
42- # Same to the aboved "upload" target, but this publishs to PyPI test server
43- # <https://test.pypi.org/>.
44- .PHONY : upload-test
45- upload-test : dist
46- $(PY ) -m twine upload --repository testpypi $< /*
57+ # ###############################################################################
58+ # Cookiecutter Incremental Updates
59+ # ###############################################################################
4760
4861# Keep up to date with the latest template.
49- # See also https://github.com/sphinx-notes/cookiecutter.
50- .PHONY : update-template
51- update-template :
62+ # See https://github.com/sphinx-notes/cookiecutter.
63+ .PHONY : tmpl-update
64+ tmpl-update :
5265 $(PY ) -m cruft update
5366
67+ .PHONY : tmpl-update-done
68+ tmpl-update-done :
69+ $(GIT ) commit -m " chore: Update project template to sphinx-notes/cookiecutter@$( shell jq -r ' .commit' .cruft.json | head -c8) "
70+
71+ .PHONY : apply-rej
72+ apply-rej :
73+ @for rej in $$(find . -name '*.rej' ) ; do \
74+ echo " applying $$ rej..." ; \
75+ wiggle --replace $$ {rej%.rej} $$ rej; \
76+ done
77+
78+ # Detect the minimum Python versions needed to run code.
79+ pyvermin :
80+ vermin --eval-annotations --target=3.12- --versions src/
81+
5482# Update project version.
5583.PHONY : bump-version
5684bump-version :
5785 @echo -n " Please enter the version to bump: "
5886 @read version && $(PY ) -m cruft update --variables-to-update " { \" version\" : \" $$ version\" }"
87+
88+ # ###############################################################################
89+ # CUSTOM TARGETS
90+ # ###############################################################################
0 commit comments