-
Notifications
You must be signed in to change notification settings - Fork 31
/
util.mk
77 lines (56 loc) · 1.47 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
66
67
68
69
70
71
72
73
74
75
76
77
# =============
# Configuration
# =============
$(eval venv := .venv)
$(eval bumpversion := $(venv)/bin/bumpversion)
$(eval pip := $(venv)/bin/pip)
$(eval pytest := $(venv)/bin/pytest)
$(eval python := $(venv)/bin/python)
$(eval sphinx := $(venv)/bin/sphinx-build)
$(eval sphinx-autobuild := $(venv)/bin/sphinx-autobuild)
$(eval twine := $(venv)/bin/twine)
# =============
# Miscellaneous
# =============
all:
@echo "Nothing to do."
clean:
@echo "Nothing to do."
# =====
# 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