-
Notifications
You must be signed in to change notification settings - Fork 10
/
Makefile
75 lines (64 loc) · 2.45 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
all: write_defaults write_constants plot_example
write_defaults: venv
sh -c '. ./venv/bin/activate; ./scripts/write_defaults.py'
./venv/bin/black pyhector/units.py
./venv/bin/black pyhector/default_config.py
write_constants: venv
sh -c './scripts/write_constants_py.sh > pyhector/constants.py'
./venv/bin/black pyhector/constants.py
plot_example: venv
sh -c '. ./venv/bin/activate; pip install matplotlib; python scripts/plot_example.py'
watchdocs: venv
sh -c '. ./venv/bin/activate; sphinx-autobuild \
--watch ../pyhector \
--ignore "*.lock" \
docs docs/_build/html;'
venv: dev-requirements.txt
[ -d ./venv ] || python3 -m venv venv
./venv/bin/pip install --upgrade pip
./venv/bin/pip install wheel
./venv/bin/pip install -Ur dev-requirements.txt
publish-on-pypi:
-rm -rf build dist
@status=$$(git status --porcelain); \
if test "x$${status}" = x; then \
./venv/bin/python setup.py sdist; \
./venv/bin/twine upload dist/*; \
else \
echo Working directory is dirty >&2; \
fi;
test-pypi-install:
$(eval TEMPVENV := $(shell mktemp -d))
python3 -m venv $(TEMPVENV)
$(TEMPVENV)/bin/pip install pip --upgrade
$(TEMPVENV)/bin/pip install pyhector
$(TEMPVENV)/bin/python -c "import sys; sys.path.remove(''); import pyhector; print(pyhector.__version__)"
publish-on-testpypi:
-rm -rf build dist
@status=$$(git status --porcelain); \
if test "x$${status}" = x; then \
./venv/bin/python setup.py sdist; \
./venv/bin/twine upload -r testpypi dist/*; \
else \
echo Working directory is dirty >&2; \
fi;
test-testpypi-install:
$(eval TEMPVENV := $(shell mktemp -d))
python3 -m venv $(TEMPVENV)
$(TEMPVENV)/bin/pip install pip --upgrade
# Install dependencies, because these are not on testpypi registry
$(TEMPVENV)/bin/pip install pandas pybind11
# Install pyhector without dependencies.
$(TEMPVENV)/bin/pip install \
-i https://testpypi.python.org/pypi pyhector \
--no-dependencies
# Remove local directory from path to get actual installed version.
$(TEMPVENV)/bin/python -c "import sys; sys.path.remove(''); import pyhector; print(pyhector.__version__)"
black: venv
@status=$$(git status --porcelain pyhector tests); \
if test "x$${status}" = x; then \
./venv/bin/black --exclude _version.py setup.py pyhector tests; \
else \
echo Not trying any formatting. Working directory is dirty ... >&2; \
fi;
.PHONY: watchdocs write_defaults write_constants plot_example publish-on-pypi test-pypi-install publish-on-testpypi test-testpypi-install black