-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
66 lines (53 loc) · 1.56 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
.PHONY: all install nopyc clean test docs check local validate-release upload
SHELL := /usr/bin/env bash
PYTHON_BIN ?= python
PROJECT_VENV ?= venv
all: local check test
venv:
$(PYTHON_BIN) -m pip install virtualenv --user
$(PYTHON_BIN) -m virtualenv $(PROJECT_VENV)
install: venv
@( \
source $(PROJECT_VENV)/bin/activate; \
python -m pip install .; \
)
nopyc:
find . -name '*.pyc' | xargs rm -f || true
find . -name __pycache__ | xargs rm -rf || true
clean: nopyc
rm -rf build dist *.egg-info $(PROJECT_VENV)
test: install
@( \
source $(PROJECT_VENV)/bin/activate; \
python -m pip install ".[dev]"; \
coverage run -m unittest discover -v -b && coverage report && coverage xml && coverage html; \
)
docs: install
@( \
source $(PROJECT_VENV)/bin/activate; \
python -m pip install ".[docs]"; \
sphinx-build -M html docs build/docs; \
)
check: install
@( \
source $(PROJECT_VENV)/bin/activate; \
python -m pip install ".[dev,docs]"; \
flake8; \
)
local:
@rm -rf *.egg-info dist
@( \
$(PYTHON_BIN) -m pip install --upgrade pip; \
$(PYTHON_BIN) -m pip install --upgrade build; \
$(PYTHON_BIN) -m build; \
$(PYTHON_BIN) -m pip install dist/*.tar.gz; \
)
validate-release:
@if [[ "${VERSION}" == "" ]]; then echo "VERSION is not set" & exit 1 ; fi
@if [[ $$(grep "__version__ = \"${VERSION}\"" hookee/__init__.py) == "" ]] ; then echo "Version not bumped in hookee/__init__.py" & exit 1 ; fi
upload: local
@( \
$(PYTHON_BIN) -m pip install --upgrade twine; \
$(PYTHON_BIN) -m build; \
$(PYTHON_BIN) -m twine upload dist/*; \
)