-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
81 lines (70 loc) · 2.51 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
76
77
78
79
80
81
venv: setup.py
[ -d ./venv ] || python3 -m venv ./venv
./venv/bin/pip install --upgrade pip
./venv/bin/pip install versioneer
./venv/bin/pip install -e .[test,docs,deploy]
touch venv
test: venv
./venv/bin/pytest --cov -rfsxEX --cov-report term-missing
docs: venv
./venv/bin/sphinx-build -M html docs docs/_build
flake8: venv
./venv/bin/flake8 src tests setup.py _version.py
.PHONY: black
black: venv
@status=$$(git status --porcelain pymagicc tests); \
if test "x$${status}" = x; then \
./venv/bin/black --exclude _version.py --py36 setup.py src tests docs/conf.py; \
else \
echo Not trying any formatting. Working directory is dirty ... >&2; \
fi;
# first time setup, follow this https://blog.jetbrains.com/pycharm/2017/05/how-to-publish-your-package-on-pypi/
# then this works
.PHONY: publish-on-testpypi
publish-on-testpypi:
-rm -rf build dist
@status=$$(git status --porcelain); \
if test "x$${status}" = x; then \
./venv/bin/python setup.py sdist bdist_wheel --universal; \
./venv/bin/twine upload -r testpypi dist/*; \
else \
echo Working directory is dirty >&2; \
fi;
test-testpypi-install: venv
$(eval TEMPVENV := $(shell mktemp -d))
python3 -m venv $(TEMPVENV)
$(TEMPVENV)/bin/pip install pip --upgrade
# Install dependencies not on testpypi registry
# e.g. $(TEMPVENV)/bin/pip install pandas
# Install pymagicc without dependencies.
$(TEMPVENV)/bin/pip install \
-i https://testpypi.python.org/pypi cmip6-data-citation-generator \
--no-dependencies --pre
@echo "This doesn't test dependencies"
$(TEMPVENV)/bin/python -c "from cmip6_data_citation_generator import *; import cmip6_data_citation_generator; print(cmip6_data_citation_generator.__version__)"
.PHONY: publish-on-pypi
publish-on-pypi:
-rm -rf build dist
@status=$$(git status --porcelain); \
if test "x$${status}" = x; then \
./venv/bin/python setup.py sdist bdist_wheel --universal; \
./venv/bin/twine upload dist/*; \
else \
echo Working directory is dirty >&2; \
fi;
test-pypi-install: venv
$(eval TEMPVENV := $(shell mktemp -d))
python3 -m venv $(TEMPVENV)
$(TEMPVENV)/bin/pip install pip --upgrade
$(TEMPVENV)/bin/pip install cmip6-data-citation-generator --pre
$(TEMPVENV)/bin/python scripts/test_install.py
.PHONY: test-install
test-install: venv
$(eval TEMPVENV := $(shell mktemp -d))
python3 -m venv $(TEMPVENV)
$(TEMPVENV)/bin/pip install pip --upgrade
$(TEMPVENV)/bin/pip install .
$(TEMPVENV)/bin/python scripts/test_install.py
clean:
rm -rf venv
.PHONY: clean test black flake8 docs publish-on-pypi test-pypi-install