Expand test coverage, bugfix
[EVA-2020-02-2.git] / Makefile
CommitLineData
ab1eb580
PH
1LIBRARY_VERSION=$(shell grep version library/setup.cfg | awk -F" = " '{print $$2}')
2LIBRARY_NAME=$(shell grep name library/setup.cfg | awk -F" = " '{print $$2}')
651e1c20
PH
3
4.PHONY: usage install uninstall
5usage:
ab1eb580
PH
6 @echo "Library: ${LIBRARY_NAME}"
7 @echo "Version: ${LIBRARY_VERSION}\n"
651e1c20
PH
8 @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"
ab1eb580 18 @echo "tag: tag the repository with the current version"
651e1c20
PH
19
20install:
21 ./install.sh
22
23uninstall:
24 ./uninstall.sh
25
26check:
27 @echo "Checking for trailing whitespace"
ab1eb580 28 @! grep -IUrn --color "[[:blank:]]$$" --exclude-dir=sphinx --exclude-dir=.tox --exclude-dir=.git --exclude=PKG-INFO
651e1c20 29 @echo "Checking for DOS line-endings"
ab1eb580 30 @! grep -IUrn --color "\r" --exclude-dir=sphinx --exclude-dir=.tox --exclude-dir=.git --exclude=Makefile
651e1c20
PH
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
ab1eb580
PH
36tag:
37 git tag -a "v${LIBRARY_VERSION}" -m "Version ${LIBRARY_VERSION}"
38
651e1c20
PH
39python-readme: library/README.rst
40
41python-license: library/LICENSE.txt
42
ab1eb580 43library/README.rst: README.md library/CHANGELOG.txt
651e1c20 44 pandoc --from=markdown --to=rst -o library/README.rst README.md
ab1eb580
PH
45 echo "" >> library/README.rst
46 cat library/CHANGELOG.txt >> library/README.rst
651e1c20
PH
47
48library/LICENSE.txt: LICENSE
49 cp LICENSE library/LICENSE.txt
50
51python-wheels: python-readme python-license
52 cd library; python3 setup.py bdist_wheel
53 cd library; python setup.py bdist_wheel
54
55python-sdist: python-readme python-license
56 cd library; python setup.py sdist
57
58python-clean:
59 -rm -r library/dist
60 -rm -r library/build
61 -rm -r library/*.egg-info
62
63python-dist: python-clean python-wheels python-sdist
64 ls library/dist
65
66python-testdeploy: python-dist
67 twine upload --repository-url https://test.pypi.org/legacy/ library/dist/*
68
69python-deploy: check python-dist
70 twine upload library/dist/*