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}'`
4 .PHONY: usage install uninstall
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"
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 "
" --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}'"
33 python-readme: library/README.rst
35 python-license: library/LICENSE.txt
37 library/README.rst: README.md
38 pandoc --from=markdown --to=rst -o library/README.rst README.md
40 library/LICENSE.txt: LICENSE
41 cp LICENSE library/LICENSE.txt
43 python-wheels: python-readme python-license
44 cd library; python3 setup.py bdist_wheel
45 cd library; python setup.py bdist_wheel
47 python-sdist: python-readme python-license
48 cd library; python setup.py sdist
53 -rm -r library/*.egg-info
55 python-dist: python-clean python-wheels python-sdist
58 python-testdeploy: python-dist
59 twine upload --repository-url https://test.pypi.org/legacy/ library/dist/*
61 python-deploy: check python-dist
62 twine upload library/dist/*