Merge branch 'master' of github.com:pimoroni/enviroplus-python
[EVA-2020-02-2.git] / Makefile
CommitLineData
651e1c20
PH
1LIBRARY_VERSION=`cat library/setup.py | grep version | awk -F"'" '{print $$2}'`
2LIBRARY_NAME=`cat library/setup.py | grep name | awk -F"'" '{print $$2}'`
3
4.PHONY: usage install uninstall
5usage:
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
17install:
18 ./install.sh
19
20uninstall:
21 ./uninstall.sh
22
23check:
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=.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
33python-readme: library/README.rst
34
35python-license: library/LICENSE.txt
36
37library/README.rst: README.md
38 pandoc --from=markdown --to=rst -o library/README.rst README.md
39
40library/LICENSE.txt: LICENSE
41 cp LICENSE library/LICENSE.txt
42
43python-wheels: python-readme python-license
44 cd library; python3 setup.py bdist_wheel
45 cd library; python setup.py bdist_wheel
46
47python-sdist: python-readme python-license
48 cd library; python setup.py sdist
49
50python-clean:
51 -rm -r library/dist
52 -rm -r library/build
53 -rm -r library/*.egg-info
54
55python-dist: python-clean python-wheels python-sdist
56 ls library/dist
57
58python-testdeploy: python-dist
59 twine upload --repository-url https://test.pypi.org/legacy/ library/dist/*
60
61python-deploy: check python-dist
62 twine upload library/dist/*