|
1 | | -# This file is generated from sphinx-notes/template. DO NOT EDIT. |
| 1 | +# This file is generated from sphinx-notes/cookiecutter. |
| 2 | +# You need to consider modifying the TEMPLATE or modifying THIS FILE. |
2 | 3 |
|
3 | 4 | LANG = en_US.UTF-8 |
4 | 5 |
|
5 | | -MAKE = make |
6 | | -PY = python3 |
7 | | -RM = rm -rf |
8 | | - |
9 | | -.PHONY: docs test dist install upload test-upload sync-template |
| 6 | +MAKE = make |
| 7 | +PY = python3 |
| 8 | +RM = rm -rf |
10 | 9 |
|
| 10 | +# Build sphinx documentation. |
| 11 | +.PHONY: docs |
11 | 12 | docs: |
12 | 13 | $(MAKE) -C docs/ |
13 | 14 |
|
| 15 | +# Run unittest. |
| 16 | +.PHONY: test |
14 | 17 | test: |
15 | 18 | $(PY) -m unittest discover -s tests -v |
16 | 19 |
|
| 20 | +# Build distribution package, for "install" or "upload". |
| 21 | +.PHONY: dist |
17 | 22 | dist: pyproject.toml |
18 | 23 | $(RM) dist/ # clean up old dist |
19 | 24 | $(PY) -m build |
20 | 25 |
|
| 26 | +# Install distribution package to user directory. |
| 27 | +# |
| 28 | +# NOTE: It may breaks your system-level packages, use at your own risk. |
| 29 | +.PHONY: install |
21 | 30 | install: dist |
| 31 | + export PIP_BREAK_SYSTEM_PACKAGES=1 # required by Python 3.11+, see PEP-668 |
22 | 32 | $(PY) -m pip install --user --no-deps --force-reinstall dist/*.whl |
23 | 33 |
|
| 34 | +# Publish wheel to PyPI offical server <https://pypi.org/> when you want to |
| 35 | +# You should have a PyPI account and have PyPI token configured. |
| 36 | +# |
| 37 | +# See also https://packaging.python.org/en/latest/tutorials/packaging-projects/#uploading-the-distribution-archives |
| 38 | +.PHONY: upload |
24 | 39 | upload: dist |
25 | 40 | $(PY) -m twine upload --repository pypi $</* |
26 | 41 |
|
27 | | -test-upload: dist |
| 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 |
28 | 46 | $(PY) -m twine upload --repository testpypi $</* |
29 | 47 |
|
30 | | -sync-template: |
31 | | - ./.sphinxnotes/template/update.py |
| 48 | +# Keep up to date with the latest template. |
| 49 | +# See also https://github.com/sphinx-notes/cookiecutter. |
| 50 | +.PHONY: update-template |
| 51 | +update-template: |
| 52 | + $(PY) -m cruft update |
| 53 | + |
| 54 | +# Update project version. |
| 55 | +.PHONY: bump-version |
| 56 | +bump-version: |
| 57 | + @echo -n "Please enter the version to bump: " |
| 58 | + @read version && $(PY) -m cruft update --variables-to-update "{ \"version\" : \"$$version\" }" |
0 commit comments