forked from evhub/coconut
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
285 lines (238 loc) · 8.82 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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
# the main test command to use when developing rapidly
.PHONY: test
test: test-mypy
.PHONY: dev
dev: clean setup
python -m pip install --upgrade -e .[dev]
pre-commit install -f --install-hooks
coconut --site-install
.PHONY: dev-py2
dev-py2: clean setup-py2
python2 -m pip install --upgrade -e .[dev]
coconut --site-install
.PHONY: dev-py3
dev-py3: clean setup-py3
python3 -m pip install --upgrade -e .[dev]
pre-commit install -f --install-hooks
coconut --site-install
.PHONY: setup
setup:
python -m ensurepip
python -m pip install --upgrade setuptools wheel pip pytest_remotedata
.PHONY: setup-py2
setup-py2:
python2 -m ensurepip
python2 -m pip install --upgrade "setuptools<58" wheel pip pytest_remotedata
.PHONY: setup-py3
setup-py3:
python3 -m ensurepip
python3 -m pip install --upgrade setuptools wheel pip pytest_remotedata
.PHONY: setup-pypy
setup-pypy:
pypy -m ensurepip
pypy -m pip install --upgrade "setuptools<58" wheel pip pytest_remotedata
.PHONY: setup-pypy3
setup-pypy3:
pypy3 -m ensurepip
pypy3 -m pip install --upgrade setuptools wheel pip pytest_remotedata
.PHONY: install
install: setup
python -m pip install -e .[tests]
.PHONY: install-py2
install-py2: setup-py2
python2 -m pip install -e .[tests]
.PHONY: install-py3
install-py3: setup-py3
python3 -m pip install -e .[tests]
.PHONY: install-pypy
install-pypy: setup-pypy
pypy -m pip install -e .[tests]
.PHONY: install-pypy3
install-pypy3: setup-pypy3
pypy3 -m pip install -e .[tests]
.PHONY: format
format: dev
pre-commit autoupdate
pre-commit run --all-files
# test-all takes a very long time and should usually only be run by CI
.PHONY: test-all
test-all: clean
pytest --strict-markers -s ./coconut/tests
# basic testing for the universal target
.PHONY: test-univ
test-univ: export COCONUT_USE_COLOR=TRUE
test-univ: clean
python ./coconut/tests --strict --line-numbers --keep-lines --force
python ./coconut/tests/dest/runner.py
python ./coconut/tests/dest/extras.py
# same as test-univ, but doesn't recompile unchanged test files;
# should only be used when testing the tests not the compiler
.PHONY: test-tests
test-tests: export COCONUT_USE_COLOR=TRUE
test-tests: clean
python ./coconut/tests --strict --line-numbers --keep-lines
python ./coconut/tests/dest/runner.py
python ./coconut/tests/dest/extras.py
# same as test-univ but uses Python 2
.PHONY: test-py2
test-py2: export COCONUT_USE_COLOR=TRUE
test-py2: clean
python2 ./coconut/tests --strict --line-numbers --keep-lines --force
python2 ./coconut/tests/dest/runner.py
python2 ./coconut/tests/dest/extras.py
# same as test-univ but uses Python 3 and --target 3
.PHONY: test-py3
test-py3: export COCONUT_USE_COLOR=TRUE
test-py3: clean
python3 ./coconut/tests --strict --line-numbers --keep-lines --force --target 3
python3 ./coconut/tests/dest/runner.py
python3 ./coconut/tests/dest/extras.py
# same as test-univ but uses PyPy
.PHONY: test-pypy
test-pypy: export COCONUT_USE_COLOR=TRUE
test-pypy: clean
pypy ./coconut/tests --strict --line-numbers --keep-lines --force
pypy ./coconut/tests/dest/runner.py
pypy ./coconut/tests/dest/extras.py
# same as test-univ but uses PyPy3
.PHONY: test-pypy3
test-pypy3: export COCONUT_USE_COLOR=TRUE
test-pypy3: clean
pypy3 ./coconut/tests --strict --line-numbers --keep-lines --force
pypy3 ./coconut/tests/dest/runner.py
pypy3 ./coconut/tests/dest/extras.py
# same as test-pypy3 but includes verbose output for better debugging
.PHONY: test-pypy3-verbose
test-pypy3-verbose: export COCONUT_USE_COLOR=TRUE
test-pypy3-verbose: clean
pypy3 ./coconut/tests --strict --line-numbers --keep-lines --force --verbose --jobs 0
pypy3 ./coconut/tests/dest/runner.py
pypy3 ./coconut/tests/dest/extras.py
# same as test-univ but also runs mypy
.PHONY: test-mypy
test-mypy: export COCONUT_USE_COLOR=TRUE
test-mypy: clean
python ./coconut/tests --strict --force --target sys --keep-lines --mypy --follow-imports silent --ignore-missing-imports --allow-redefinition
python ./coconut/tests/dest/runner.py
python ./coconut/tests/dest/extras.py
# same as test-mypy but uses the universal target
.PHONY: test-mypy-univ
test-mypy-univ: export COCONUT_USE_COLOR=TRUE
test-mypy-univ: clean
python ./coconut/tests --strict --force --keep-lines --mypy --follow-imports silent --ignore-missing-imports --allow-redefinition
python ./coconut/tests/dest/runner.py
python ./coconut/tests/dest/extras.py
# same as test-univ but includes verbose output for better debugging
.PHONY: test-verbose
test-verbose: export COCONUT_USE_COLOR=TRUE
test-verbose: clean
python ./coconut/tests --strict --line-numbers --keep-lines --force --verbose --jobs 0
python ./coconut/tests/dest/runner.py
python ./coconut/tests/dest/extras.py
# same as test-mypy but uses --verbose
.PHONY: test-mypy-verbose
test-mypy-verbose: export COCONUT_USE_COLOR=TRUE
test-mypy-verbose: clean
python ./coconut/tests --strict --force --target sys --verbose --jobs 0 --keep-lines --mypy --follow-imports silent --ignore-missing-imports --allow-redefinition
python ./coconut/tests/dest/runner.py
python ./coconut/tests/dest/extras.py
# same as test-mypy but uses --check-untyped-defs
.PHONY: test-mypy-all
test-mypy-all: export COCONUT_USE_COLOR=TRUE
test-mypy-all: clean
python ./coconut/tests --strict --force --target sys --keep-lines --mypy --follow-imports silent --ignore-missing-imports --allow-redefinition --check-untyped-defs
python ./coconut/tests/dest/runner.py
python ./coconut/tests/dest/extras.py
# same as test-univ but also tests easter eggs
.PHONY: test-easter-eggs
test-easter-eggs: export COCONUT_USE_COLOR=TRUE
test-easter-eggs: clean
python ./coconut/tests --strict --line-numbers --keep-lines --force
python ./coconut/tests/dest/runner.py --test-easter-eggs
python ./coconut/tests/dest/extras.py
# same as test-univ but uses python pyparsing
.PHONY: test-pyparsing
test-pyparsing: export COCONUT_PURE_PYTHON=TRUE
test-pyparsing: test-univ
# same as test-univ but uses --minify
.PHONY: test-minify
test-minify: export COCONUT_USE_COLOR=TRUE
test-minify: clean
python ./coconut/tests --strict --line-numbers --keep-lines --force --minify
python ./coconut/tests/dest/runner.py
python ./coconut/tests/dest/extras.py
# same as test-univ but watches tests before running them
.PHONY: test-watch
test-watch: export COCONUT_USE_COLOR=TRUE
test-watch: clean
python ./coconut/tests --strict --line-numbers --keep-lines --force
coconut ./coconut/tests/src/cocotest/agnostic ./coconut/tests/dest/cocotest --watch --strict --line-numbers --keep-lines
python ./coconut/tests/dest/runner.py
python ./coconut/tests/dest/extras.py
# mini test that just compiles agnostic tests with fully synchronous output
.PHONY: test-mini
test-mini:
coconut ./coconut/tests/src/cocotest/agnostic ./coconut/tests/dest/cocotest --force --jobs 0
.PHONY: debug-comp-crash
debug-comp-crash: export COCONUT_USE_COLOR=TRUE
debug-comp-crash: export COCONUT_PURE_PYTHON=TRUE
debug-comp-crash:
python -X dev -m coconut ./coconut/tests/src/cocotest/agnostic ./coconut/tests/dest/cocotest --strict --line-numbers --keep-lines --force --jobs 0
.PHONY: debug-test-crash
debug-test-crash:
python -X dev ./coconut/tests/dest/runner.py
.PHONY: diff
diff:
git diff origin/develop
.PHONY: fix-develop
fix-develop:
git merge master -s ours
.PHONY: docs
docs: clean
sphinx-build -b html . ./docs
rm -f index.rst
.PHONY: clean
clean:
rm -rf ./docs ./dist ./build ./coconut/tests/dest ./bbopt ./pyprover ./pyston ./coconut-prelude index.rst ./.mypy_cache
.PHONY: wipe
wipe: clean
rm -rf vprof.json profile.log *.egg-info
-find . -name "__pycache__" -delete
-C:/GnuWin32/bin/find.exe . -name "__pycache__" -delete
-find . -name "*.pyc" -delete
-C:/GnuWin32/bin/find.exe . -name "*.pyc" -delete
-python -m coconut --site-uninstall
-python3 -m coconut --site-uninstall
-python2 -m coconut --site-uninstall
-pip uninstall coconut
-pip uninstall coconut-develop
-pip3 uninstall coconut
-pip3 uninstall coconut-develop
-pip2 uninstall coconut
-pip2 uninstall coconut-develop
.PHONY: build
build:
python setup.py sdist bdist_wheel
.PHONY: just-upload
just-upload: build
pip install --upgrade --ignore-installed twine
twine upload dist/*
.PHONY: upload
upload: wipe dev just-upload
.PHONY: check-reqs
check-reqs:
python ./coconut/requirements.py
.PHONY: profile-parser
profile-parser: export COCONUT_USE_COLOR=TRUE
profile-parser: export COCONUT_PURE_PYTHON=TRUE
profile-parser:
coconut ./coconut/tests/src/cocotest/agnostic ./coconut/tests/dest/cocotest --force --profile --verbose --recursion-limit 4096 2>&1 | tee ./profile.log
.PHONY: profile-time
profile-time:
vprof -c h "./coconut ./coconut/tests/src/cocotest/agnostic ./coconut/tests/dest/cocotest --force" --output-file ./vprof.json
.PHONY: profile-memory
profile-memory:
vprof -c m "./coconut ./coconut/tests/src/cocotest/agnostic ./coconut/tests/dest/cocotest --force" --output-file ./vprof.json
.PHONY: view-profile
view-profile:
vprof --input-file ./vprof.json