-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
61 lines (48 loc) · 1.32 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
GLOBAL_PY := python3
BUILD_VENV ?= .build_venv
BUILD_PY := $(BUILD_VENV)/bin/python
.PHONY: init
init: $(BUILD_VENV)
$(BUILD_VENV):
$(GLOBAL_PY) -m venv $(BUILD_VENV)
$(BUILD_PY) -m pip install -U pip
.PHONY: format
format: $(BUILD_VENV)/bin/black
$(BUILD_PY) -m black .
.PHONY: test
test: $(BUILD_VENV)/bin/tox
$(BUILD_PY) -m tox -p auto -o
.PHONY: upgrade-deps
upgrade-deps: $(BUILD_VENV)/bin/pip-compile
$(BUILD_VENV)/bin/pip-compile -U
.PHONY: bump-version
bump-version: is-git-clean
bump2version patch
.PHONY: is-git-clean
is-git-clean:
@status=$$(git fetch origin && git status -s -b) ;\
if test "$${status}" != "## main...origin/main"; then \
echo; \
echo Git working directory is dirty, aborting >&2; \
false; \
fi
.PHONY: build
build: $(BUILD_VENV)/bin/wheel $(BUILD_VENV)/bin/twine
$(BUILD_PY) setup.py sdist bdist_wheel
.PHONY: clean
clean:
rm -rf build/
rm -rf dist/
rm -rf *egg-info/
.PHONY: publish
publish:
username=$$(op read op://Dataspeilet/pypi-upload-token/username) &&\
password=$$(op read op://Dataspeilet/pypi-upload-token/credential) &&\
$(GLOBAL_PY) -m twine upload -u $$username -p $$password dist/*
###
# Python build dependencies
##
$(BUILD_VENV)/bin/pip-compile: $(BUILD_VENV)
$(BUILD_PY) -m pip install -U pip-tools
$(BUILD_VENV)/bin/%: $(BUILD_VENV)
$(BUILD_PY) -m pip install -U $*