forked from chaimleib/intervaltree
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
155 lines (124 loc) · 3.29 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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
SHELL=bash
SCRIPTS_DIR:=$(PWD)/scripts
# any files ending in .py?, and any folders named __pycache__
TEMPS=$(shell \
find intervaltree test \
\( -type f -name '*.py?' ! -path '*/__pycache__/*' \) \
-o \( -type d -name '__pycache__' \) \
)
PYTHONS:=2.7.18 3.6.15 3.7.16 3.8.16 3.9.16 3.10.10 3.11.2
PYTHON_MAJORS:=$(shell \
echo "$(PYTHONS)" | \
tr ' ' '\n' | cut -d. -f1 | \
uniq \
)
PYTHON_MINORS:=$(shell \
echo "$(PYTHONS)" | \
tr ' ' '\n' | cut -d. -f1,2 | \
uniq \
)
# PyPI server name, as specified in ~/.pypirc
# See http://peterdowns.com/posts/first-time-with-pypi.html
PYPI=pypitest
TWINE=twine
# default target
all: test
test: pytest
quicktest:
PYPI=$(PYPI) python setup.py test
coverage:
coverage run --source=intervaltree setup.py develop test
coverage report
coverage html
pytest: deps-dev
PYTHONS="$(PYTHONS)" PYTHON_MINORS="$(PYTHON_MINORS)" "$(SCRIPTS_DIR)/testall.sh"
clean: clean-build clean-eggs clean-temps
distclean: clean
clean-build:
rm -rf dist build
clean-eggs:
rm -rf *.egg* .eggs/
clean-temps:
rm -rf $(TEMPS)
install-testpypi:
pip install \
--no-cache-dir \
--index-url https://test.pypi.org/simple/ \
--extra-index-url https://pypi.org/simple \
intervaltree
install-pypi:
pip install intervaltree
install-develop:
PYPI=$(PYPI) python setup.py develop
uninstall:
pip uninstall intervaltree
# Register at PyPI
register:
PYPI=$(PYPI) python setup.py register -r $(PYPI)
# Setup for live upload
release:
$(eval PYPI=pypi)
# Build source distribution
sdist-build: distclean deps-dev
PYPI=$(PYPI) python setup.py sdist
# Build dist distribution
bdist-build: distclean deps-dev
PYPI=$(PYPI) python setup.py bdist_wheel
dist-upload: sdist-build bdist-build
if [[ "$(PYPI)" == pypitest ]]; then \
$(TWINE) upload --repository-url https://test.pypi.org/legacy/ dist/*; \
else \
$(TWINE) upload dist/*; \
fi
deps-dev: pyenv-install-versions
# Uploads to test server, unless the release target was run too
upload: test clean dist-upload
pyenv-is-installed:
pyenv --version &>/dev/null || (echo "ERROR: pyenv not installed" && false)
pyenv-install-versions: pyenv-is-installed
for pyver in $(PYTHONS); do (echo N | pyenv install $$pyver) || true; done
for pyver in $(PYTHONS); do \
export PYENV_VERSION=$$pyver; \
pip install -U pip; \
pip install -U pytest; \
done | grep -v 'Requirement already satisfied, skipping upgrade'
# twine and wheel needed only under latest PYTHONS version for uploading to PYPI
export PYENV_VERSION=$(shell \
echo $(PYTHONS) | \
tr ' ' '\n' | \
tail -n1 \
)
pip install -U twine
pip install -U wheel
pyenv rehash
# for debugging the Makefile
env:
@echo
@echo TEMPS="\"$(TEMPS)\""
@echo PYTHONS="\"$(PYTHONS)\""
@echo PYTHON_MAJORS="\"$(PYTHON_MAJORS)\""
@echo PYTHON_MINORS="\"$(PYTHON_MINORS)\""
@echo PYPI="\"$(PYPI)\""
.PHONY: all \
test \
quicktest \
pytest \
clean \
distclean \
clean-build \
clean-eggs \
clean-temps \
install-testpypi \
install-pypi \
install-develop \
pyenv-install-versions \
pyenv-is-installed \
uninstall \
register \
release \
sdist-upload \
deps-ci \
deps-dev \
pm-update \
upload \
env