|
1 | | -# This file is generated from sphinx-notes/template. |
| 1 | +# This file is generated from sphinx-notes/cookiecutter. |
2 | 2 | # You need to consider modifying the TEMPLATE or modifying THIS FILE. |
3 | 3 |
|
4 | 4 | LANG = en_US.UTF-8 |
5 | 5 |
|
6 | | -MAKE = make |
7 | | -PY = python3 |
8 | | -RM = rm -rf |
| 6 | +MAKE = make |
| 7 | +PY = python3 |
| 8 | +RM = rm -rf |
9 | 9 |
|
| 10 | +# Build sphinx documentation. |
10 | 11 | .PHONY: docs |
11 | 12 | docs: |
12 | 13 | $(MAKE) -C docs/ |
13 | 14 |
|
| 15 | +# Run unittest. |
14 | 16 | .PHONY: test |
15 | 17 | test: |
16 | 18 | $(PY) -m unittest discover -s tests -v |
17 | 19 |
|
| 20 | +# Build distribution package, for "install" or "upload". |
18 | 21 | .PHONY: dist |
19 | 22 | dist: pyproject.toml |
20 | 23 | $(RM) dist/ # clean up old dist |
21 | 24 | $(PY) -m build |
22 | 25 |
|
| 26 | +# Install distribution package to user directory. |
| 27 | +# |
| 28 | +# NOTE: It may breaks your system-level packages, use at your own risk. |
23 | 29 | .PHONY: install |
24 | 30 | install: dist |
| 31 | +export PIP_BREAK_SYSTEM_PACKAGES=1 # required by Python 3.11+, see PEP-668 |
25 | 32 | $(PY) -m pip install --user --no-deps --force-reinstall dist/*.whl |
26 | 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 |
27 | 38 | .PHONY: upload |
28 | 39 | upload: dist |
29 | 40 | $(PY) -m twine upload --repository pypi $</* |
30 | 41 |
|
31 | | -.PHONY: test-upload |
32 | | -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 |
33 | 46 | $(PY) -m twine upload --repository testpypi $</* |
34 | 47 |
|
| 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\" }" |
| 59 | + |
35 | 60 | # Usage: make cli args=--help |
36 | 61 | .PHONY: cli |
37 | 62 | cli: |
|
0 commit comments