-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
105 lines (82 loc) · 3.12 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
ROOT = .
include ${ROOT}/defs.mk
pyprogs = $(shell file -F $$'\t' bin/* | awk '/Python script/{print $$1}')
pytests = tests/libtests/*.py
pypi_url = https://upload.pypi.org/simple/
testpypi_url = https://test.pypi.org/simple/
version = $(shell PYTHONPATH=lib ${PYTHON} -c "import primersjuju; print(primersjuju.__version__)")
# mdl is an uncommon program to verify markdown
have_mdl = $(shell which mdl >&/dev/null && echo yes || echo no)
have_mdlinkcheck = $(shell which markdown-link-check >&/dev/null && echo yes || echo no)
help:
@echo "clean - remove all build, test, coverage and Python artifacts"
@echo "real-clean - remove dev-venv as well"
@echo "venv - setup local venv"
@echo "doc - build various pieces of the doc"
@echo "lint - check style with flake8"
@echo "lint-doc - check documentation"
@echo "lint-all - lint plus lint-doc"
@echo "lint-pages - lint github pages, must have been pushed first"
@echo "vulture - find unused code"
@echo "test - run tests quickly with the default Python"
@echo "install - install the package to the active Python's site-packages"
@echo "dist - package"
@echo "test-pip - test install the package using pip"
@echo "release-testpypi - test upload to testpypi"
@echo "test-release-testpypi - install from testpypi"
@echo "release - package and upload a release"
@echo "test-release - test final release"
lint:
${FLAKE8} --color=never ${pyprogs} ${pytests} lib
.PHONY: venv
venv:
test -x ${dev_venv} || ${SYS_PYTHON} -m venv ${dev_venv}
${PIP} install --upgrade pip
${PIP} install --upgrade wheel
${PIP} install --upgrade -r requirements-dev.txt
${PIP} install --upgrade -e .
# this gets a lot of false-positive, just use for code cleanup rather than making it
# standard
vulture:
${VULTURE} ${pyprogs} ${pytests} lib
test:
cd tests && ${MAKE} test
real-clean: clean
rm -rf dev-venv/
clean: test_clean
rm -rf build/ dist/ ${dev_venv}/ lib/*.egg-info/ lib/primersjuju/__pycache__/ tests/.pytest_cache/
test_clean:
cd tests && ${MAKE} clean
define envsetup
@rm -rf ${dev_venv}/
mkdir -p ${dev_venv}
${PYTHON} -m virtualenv ${dev_venv}
endef
envact = source ${dev_venv}/bin/activate
dist_tar = dist/primersjuju-${version}.tar.gz
dist_whl = dist/primersjuju-${version}-py3-none-any.whl
pkgver_spec = primersjuju-tools==${version}
dist: clean
${PYTHON} setup.py sdist
${PYTHON} setup.py bdist_wheel
@ls -l ${dist_tar}
@ls -l ${dist_whl}
# test install locally
test-pip: dist
${envsetup}
${envact} && cd ${dev_venv} && ${PIP} install --no-cache-dir $(realpath ${dist_tar})
${envact} && cd tests ${MAKE} test
# test release to testpypi
release-testpypi: dist
${TWINE} upload --repository=testpypi ${dist_whl} ${dist_tar}
# test release install from testpypi
test-release-testpypi:
${envsetup}
${envact} && cd ${dev_venv} && ${PIP} install --no-cache-dir --index-url=${testpypi_url} --extra-index-url=https://pypi.org/simple ${pkgver_spec}
${envact} && cd tests && ${MAKE} test
release: dist
${TWINE} upload --repository=pypi ${dist_whl} ${dist_tar}
test-release:
${envsetup}
${envact} && cd ${dev_venv} && ${PIP} install --no-cache-dir ${pkgver_spec}
${envact} && cd tests && ${MAKE} test