| 1 | LIBRARY_VERSION=`cat library/setup.py | grep version | awk -F"'" '{print $$2}'` |
| 2 | LIBRARY_NAME=`cat library/setup.py | grep name | awk -F"'" '{print $$2}'` |
| 3 | |
| 4 | .PHONY: usage install uninstall |
| 5 | usage: |
| 6 | @echo "Usage: make <target>, where target is one of:\n" |
| 7 | @echo "install: install the library locally from source" |
| 8 | @echo "uninstall: uninstall the local library" |
| 9 | @echo "check: peform basic integrity checks on the codebase" |
| 10 | @echo "python-readme: generate library/README.rst from README.md" |
| 11 | @echo "python-wheels: build python .whl files for distribution" |
| 12 | @echo "python-sdist: build python source distribution" |
| 13 | @echo "python-clean: clean python build and dist directories" |
| 14 | @echo "python-dist: build all python distribution files" |
| 15 | @echo "python-testdeploy: build all and deploy to test PyPi" |
| 16 | |
| 17 | install: |
| 18 | ./install.sh |
| 19 | |
| 20 | uninstall: |
| 21 | ./uninstall.sh |
| 22 | |
| 23 | check: |
| 24 | @echo "Checking for trailing whitespace" |
| 25 | @! grep -IUrn --color "[[:blank:]]$$" --exclude-dir=.tox --exclude-dir=.git --exclude=PKG-INFO |
| 26 | @echo "Checking for DOS line-endings" |
| 27 | @! grep -IUrn --color "\r" --exclude-dir=fonts --exclude-dir=.tox --exclude-dir=.git --exclude=Makefile |
| 28 | @echo "Checking library/CHANGELOG.txt" |
| 29 | @cat library/CHANGELOG.txt | grep ^${LIBRARY_VERSION} |
| 30 | @echo "Checking library/${LIBRARY_NAME}/__init__.py" |
| 31 | @cat library/${LIBRARY_NAME}/__init__.py | grep "^__version__ = '${LIBRARY_VERSION}'" |
| 32 | |
| 33 | python-readme: library/README.rst |
| 34 | |
| 35 | python-license: library/LICENSE.txt |
| 36 | |
| 37 | library/README.rst: README.md |
| 38 | pandoc --from=markdown --to=rst -o library/README.rst README.md |
| 39 | |
| 40 | library/LICENSE.txt: LICENSE |
| 41 | cp LICENSE library/LICENSE.txt |
| 42 | |
| 43 | python-wheels: python-readme python-license |
| 44 | cd library; python3 setup.py bdist_wheel |
| 45 | cd library; python setup.py bdist_wheel |
| 46 | |
| 47 | python-sdist: python-readme python-license |
| 48 | cd library; python setup.py sdist |
| 49 | |
| 50 | python-clean: |
| 51 | -rm -r library/dist |
| 52 | -rm -r library/build |
| 53 | -rm -r library/*.egg-info |
| 54 | |
| 55 | python-dist: python-clean python-wheels python-sdist |
| 56 | ls library/dist |
| 57 | |
| 58 | python-testdeploy: python-dist |
| 59 | twine upload --repository-url https://test.pypi.org/legacy/ library/dist/* |
| 60 | |
| 61 | python-deploy: check python-dist |
| 62 | twine upload library/dist/* |