-
Notifications
You must be signed in to change notification settings - Fork 0
/
util.mk
65 lines (47 loc) · 1.26 KB
/
util.mk
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
# =============
# Configuration
# =============
$(eval venv := .venv)
$(eval pip := $(venv)/bin/pip)
$(eval python := $(venv)/bin/python)
$(eval pytest := $(venv)/bin/pytest)
$(eval bumpversion := $(venv)/bin/bumpversion)
$(eval twine := $(venv)/bin/twine)
# =====
# Setup
# =====
# Setup Python virtualenv
setup-virtualenv:
@test -e $(python) || python3 -m venv $(venv)
# Install requirements for development.
virtualenv-dev: setup-virtualenv
@test -e $(pytest) || $(pip) install --upgrade --requirement=requirements-test.txt
# Install requirements for releasing.
install-releasetools: setup-virtualenv
@$(pip) install --quiet --requirement requirements-release.txt --upgrade
# =======
# Release
# =======
# Release this piece of software.
# Uses the fine ``bumpversion`` utility.
#
# Synopsis::
#
# make release bump={patch,minor,major}
release: bumpversion push build pypi-upload
bumpversion: install-releasetools
@$(bumpversion) $(bump)
push:
git push && git push --tags
build:
@$(python) -m build
pypi-upload: install-releasetools
twine upload --verbose --skip-existing dist/*{.tar.gz,.whl}
# ==============
# Software tests
# ==============
# Invoke pytest.
.PHONY: test
pytest: setup-package
$(pytest)
test: pytest