|
1 | | -LIBRARY_VERSION=$(shell grep version library/setup.cfg | awk -F" = " '{print $$2}') |
2 | | -LIBRARY_NAME=$(shell grep name library/setup.cfg | awk -F" = " '{print $$2}') |
| 1 | +LIBRARY_NAME := $(shell hatch project metadata name 2> /dev/null) |
| 2 | +LIBRARY_VERSION := $(shell hatch version 2> /dev/null) |
3 | 3 |
|
4 | | -.PHONY: usage install uninstall |
| 4 | +.PHONY: usage install uninstall check pytest qa build-deps check tag wheel sdist clean dist testdeploy deploy |
5 | 5 | usage: |
| 6 | +ifdef LIBRARY_NAME |
6 | 7 | @echo "Library: ${LIBRARY_NAME}" |
7 | 8 | @echo "Version: ${LIBRARY_VERSION}\n" |
| 9 | +else |
| 10 | + @echo "WARNING: You should 'make dev-deps'\n" |
| 11 | +endif |
8 | 12 | @echo "Usage: make <target>, where target is one of:\n" |
9 | | - @echo "install: install the library locally from source" |
10 | | - @echo "uninstall: uninstall the local library" |
11 | | - @echo "check: peform basic integrity checks on the codebase" |
12 | | - @echo "python-readme: generate library/README.rst from README.md" |
13 | | - @echo "python-wheels: build python .whl files for distribution" |
14 | | - @echo "python-sdist: build python source distribution" |
15 | | - @echo "python-clean: clean python build and dist directories" |
16 | | - @echo "python-dist: build all python distribution files" |
17 | | - @echo "python-testdeploy: build all and deploy to test PyPi" |
18 | | - @echo "tag: tag the repository with the current version" |
| 13 | + @echo "install: install the library locally from source" |
| 14 | + @echo "uninstall: uninstall the local library" |
| 15 | + @echo "dev-deps: install Python dev dependencies" |
| 16 | + @echo "check: perform basic integrity checks on the codebase" |
| 17 | + @echo "qa: run linting and package QA" |
| 18 | + @echo "pytest: run Python test fixtures" |
| 19 | + @echo "clean: clean Python build and dist directories" |
| 20 | + @echo "build: build Python distribution files" |
| 21 | + @echo "testdeploy: build and upload to test PyPi" |
| 22 | + @echo "deploy: build and upload to PyPi" |
| 23 | + @echo "tag: tag the repository with the current version\n" |
19 | 24 |
|
20 | 25 | install: |
21 | | - ./install.sh |
| 26 | + ./install.sh --unstable |
22 | 27 |
|
23 | 28 | uninstall: |
24 | 29 | ./uninstall.sh |
25 | 30 |
|
26 | | -check: |
27 | | - @echo "Checking for trailing whitespace" |
28 | | - @! grep -IUrn --color "[[:blank:]]$$" --exclude-dir=sphinx --exclude-dir=.tox --exclude-dir=.git --exclude=PKG-INFO |
29 | | - @echo "Checking for DOS line-endings" |
30 | | - @! grep -IUrn --color "" --exclude-dir=sphinx --exclude-dir=.tox --exclude-dir=.git --exclude=Makefile |
31 | | - @echo "Checking library/CHANGELOG.txt" |
32 | | - @cat library/CHANGELOG.txt | grep ^${LIBRARY_VERSION} |
33 | | - @echo "Checking library/${LIBRARY_NAME}/__init__.py" |
34 | | - @cat library/${LIBRARY_NAME}/__init__.py | grep "^__version__ = '${LIBRARY_VERSION}'" |
35 | | - |
36 | | -tag: |
37 | | - git tag -a "v${LIBRARY_VERSION}" -m "Version ${LIBRARY_VERSION}" |
| 31 | +dev-deps: |
| 32 | + python3 -m pip install -r requirements-dev.txt |
| 33 | + sudo apt install dos2unix |
38 | 34 |
|
39 | | -python-readme: library/README.md |
40 | | - |
41 | | -python-license: library/LICENSE.txt |
| 35 | +check: |
| 36 | + @bash check.sh |
42 | 37 |
|
43 | | -library/README.md: README.md library/CHANGELOG.txt |
44 | | - cp README.md library/README.md |
45 | | - printf "\n# Changelog\n" >> library/README.md |
46 | | - cat library/CHANGELOG.txt >> library/README.md |
| 38 | +qa: |
| 39 | + tox -e qa |
47 | 40 |
|
48 | | -library/LICENSE.txt: LICENSE |
49 | | - cp LICENSE library/LICENSE.txt |
| 41 | +pytest: |
| 42 | + tox -e py |
50 | 43 |
|
51 | | -python-wheels: python-readme python-license |
52 | | - cd library; python3 setup.py bdist_wheel |
| 44 | +nopost: |
| 45 | + @bash check.sh --nopost |
53 | 46 |
|
54 | | -python-sdist: python-readme python-license |
55 | | - cd library; python3 setup.py sdist |
| 47 | +tag: |
| 48 | + git tag -a "v${LIBRARY_VERSION}" -m "Version ${LIBRARY_VERSION}" |
56 | 49 |
|
57 | | -python-clean: |
58 | | - -rm -r library/dist |
59 | | - -rm -r library/build |
60 | | - -rm -r library/*.egg-info |
| 50 | +build: check |
| 51 | + @hatch build |
61 | 52 |
|
62 | | -python-dist: python-clean python-wheels python-sdist |
63 | | - ls library/dist |
| 53 | +clean: |
| 54 | + -rm -r dist |
64 | 55 |
|
65 | | -python-testdeploy: python-dist |
66 | | - twine upload --repository-url https://test.pypi.org/legacy/ library/dist/* |
| 56 | +testdeploy: build |
| 57 | + twine upload --repository testpypi dist/* |
67 | 58 |
|
68 | | -python-deploy: check python-dist |
69 | | - twine upload library/dist/* |
| 59 | +deploy: nopost build |
| 60 | + twine upload dist/* |
0 commit comments