-
-
Notifications
You must be signed in to change notification settings - Fork 29
/
tox.ini
355 lines (320 loc) · 8.28 KB
/
tox.ini
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
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
[tox]
envlist = python
minversion = 3.16.1
requires =
setuptools >= 40.9.0
pip >= 19.0.3
# tox-venv >= 0.4.0
isolated_build = true
[testenv]
isolated_build = true
usedevelop = false
deps =
Cython
pytest
pytest-cov
pytest-faulthandler; python_version < "3"
pytest-forked
pytest-xdist
setenv =
ANSIBLE_PYLIBSSH_TRACING = {env:ANSIBLE_PYLIBSSH_TRACING:1}
CATCHSEGV_BINARY = {env:CATCHSEGV_BINARY:}
PYTHONPATH = {toxinidir}/bin
SEGFAULT_SIGNALS = all
commands =
sh -c "CFLAGS=-DCYTHON_TRACE_NOGIL=1 \
{envbindir}/cythonize \
--force \
--inplace \
--directive=embedsignature=True \
--directive=emit_code_comments=True \
--directive=linetrace=True \
--directive=profile=True \
{toxinidir}/src/pylibsshext/*.pyx"
{env:CATCHSEGV_BINARY:} {envpython} -m \
pytest \
--cov-config={toxinidir}/.coveragerc \
--cov={envsitepackagesdir}/pylibsshext \
{posargs:}
whitelist_externals =
{env:CATCHSEGV_BINARY:}
sh
[testenv:test-binary-dists]
skip_install = true
commands_pre =
# WARNING: Be sure to keep the `--no-index` arg.
# WARNING: Otherwise, pip may prefer PyPI over
# WARNING: the local dists dir.
{envpython} -m pip install \
--force-reinstall \
--only-binary ansible-pylibssh \
-f {env:PEP517_OUT_DIR} \
--no-index \
ansible-pylibssh
setenv =
{[dists]setenv}
[testenv:test-source-dists]
skip_install = true
commands_pre =
# Pre-fetch sdist build deps:
{envpython} -m pip download \
--prefer-binary \
--only-binary Cython \
--only-binary setuptools \
--only-binary setuptools-scm \
--only-binary setuptools-scm-git-archive \
--only-binary toml \
--only-binary wheel \
--dest {toxinidir}/.github/workflows/.tmp/deps \
Cython expandvars setuptools \
setuptools-scm setuptools-scm-git-archive \
toml wheel
# WARNING: Be sure to keep the `--no-index` arg.
# WARNING: Otherwise, pip may prefer PyPI over
# WARNING: the local dists dir.
{envpython} -m pip install \
--force-reinstall \
--no-binary ansible-pylibssh \
-f {env:PEP517_OUT_DIR} \
-f {toxinidir}/.github/workflows/.tmp/deps \
--no-index \
ansible-pylibssh
setenv =
{[dists]setenv}
[dists]
setenv =
{[testenv]setenv}
PEP517_OUT_DIR = {env:PEP517_OUT_DIR:{toxinidir}/dist}
[testenv:cleanup-dists]
description =
Wipe the the dists/ folder
usedevelop = false
skip_install = true
deps =
setenv =
{[dists]setenv}
commands =
rm -rfv {env:PEP517_OUT_DIR}
whitelist_externals =
rm
[testenv:build-dists]
description =
Build non-universal dists and put them into the dists/ folder
depends =
cleanup-dists
isolated_build = true
# `usedevelop = true` overrides `skip_install` instruction, it's unwanted
usedevelop = false
skip_install = true
deps =
# NOTE: v0.7.0 added support for backend-path in pyproject.toml but
# NOTE: why not use something newer if we can?
pep517 >= 0.8.2
passenv =
PEP517_ARGS
setenv =
{[dists]setenv}
commands =
{envpython} -m pep517.build \
{env:PEP517_ARGS:--source --binary} \
--out-dir {env:PEP517_OUT_DIR} \
{toxinidir}
[testenv:build-wheels-pip]
description =
Build non-universal wheels dists and
put them into the dists/ folder
depends =
cleanup-dists
isolated_build = true
# `usedevelop = true` overrides `skip_install` instruction, it's unwanted
usedevelop = false
skip_install = true
deps =
# NOTE: v20 added support for backend-path
# NOTE: in pyproject.toml and we use it
pip >= 20
setenv =
{[dists]setenv}
commands =
{envpython} -m pip wheel \
--no-deps \
--wheel-dir "{env:PEP517_OUT_DIR}" \
"{toxinidir}"
[testenv:delocate-macos-wheels]
description = Vendor external deps into macOS wheels
# only run under macOS
platform = ^darwin
depends =
build-dists
build-wheels-pip
isolated_build = true
# `usedevelop = true` overrides `skip_install` instruction, it's unwanted
usedevelop = false
skip_install = true
deps =
delocate
setenv =
{[dists]setenv}
commands =
{envpython} -m \
delocate.cmd.delocate_listdeps \
--all \
{posargs:"{env:PEP517_OUT_DIR}"/*.whl}
{envpython} -m \
delocate.cmd.delocate_wheel \
-v \
{posargs:"{env:PEP517_OUT_DIR}"/*.whl}
{envpython} -m \
delocate.cmd.delocate_listdeps \
--all \
{posargs:"{env:PEP517_OUT_DIR}"/*.whl}
[testenv:metadata-validation]
description =
Verify that dists under the dist/ dir have valid metadata
depends =
build-dists
build-dists-manylinux
build-wheels-pip
delocate-macos-wheels
deps =
twine
usedevelop = false
skip_install = true
setenv =
{[dists]setenv}
commands =
twine check {env:PEP517_OUT_DIR}/*
[testenv:build-dists-manylinux]
basepython = python3
description =
Build manylinux wheels in a container and put them into the dists/ folder
commands =
# NOTE: `-t` shouldn't be used here because GitHub Actions
# NOTE: workflows don't have TTY
{env:DOCKER_EXECUTABLE:docker} run \
-i --rm \
-v {toxinidir}:/io \
-e ANSIBLE_PYLIBSSH_TRACING \
pyca/cryptography-manylinux1:x86_64 \
/io/build-scripts/build-manylinux-wheels.sh \
0.9.4 \
{posargs:}
deps =
isolated_build = true
passenv =
# alternatively set `DOCKER_EXECUTABLE=podman` outside the container
DOCKER_EXECUTABLE
HOME
skip_install = true
whitelist_externals =
{env:DOCKER_EXECUTABLE:docker}
[testenv:lint]
basepython = python3
commands =
{envpython} -m pre_commit run --show-diff-on-failure {posargs:--all-files}
# Print out the advise of how to install pre-commit from this env into Git:
-{envpython} -c \
'cmd = "{envpython} -m pre_commit install"; scr_width = len(cmd) + 10; sep = "=" * scr_width; cmd_str = " $ " + cmd; '\
'print("\n" + sep + "\nTo install pre-commit hooks into the Git repo, run:\n\n" + cmd_str + "\n\n" + sep + "\n")'
deps =
pre-commit
# pylint
isolated_build = true
skip_install = true
[testenv:build-docs]
basepython = python3
depends =
make-changelog
deps =
-r{toxinidir}/docs/requirements.in
-c{toxinidir}/docs/requirements.txt
description = Build The Docs
commands =
# Retrieve possibly missing commits:
-git fetch --unshallow
-git fetch --tags
# Build the html docs with Sphinx:
{envpython} -m sphinx \
-j auto \
-b html \
--color \
-a \
-n \
-W \
-d "{temp_dir}/.doctrees" \
. \
"{envdir}/docs_out"
# Rebuild the changelog html document specifically:
{envpython} -m sphinx \
-j auto \
-b html \
--color \
-E \
-n \
-W \
-d "{temp_dir}/.doctrees" \
. \
"{envdir}/docs_out" \
"{toxinidir}/docs/changelog.rst"
# Print out the output docs dir and a way to serve html:
-{envpython} -c\
'import pathlib;\
docs_dir = pathlib.Path(r"{envdir}") / "docs_out";\
index_file = docs_dir / "index.html";\
print("\n" + "=" * 120 +\
f"\n\nDocumentation available under:\n\n\
\tfile://\{index_file\}\n\nTo serve docs, use\n\n\
\t$ python3 -m http.server --directory \
\N\{QUOTATION MARK\}\{docs_dir\}\N\{QUOTATION MARK\} 0\n\n" +\
"=" * 120)'
changedir = {toxinidir}/docs
isolated_build = true
passenv =
SSH_AUTH_SOCK
skip_install = true
whitelist_externals =
git
[testenv:check-changelog]
basepython = {[testenv:make-changelog]basepython}
description =
Check Towncrier change notes
commands =
{envpython} -m \
towncrier.check \
--compare-with origin/devel {posargs:}
deps =
{[testenv:make-changelog]deps}
isolated_build = {[testenv:make-changelog]isolated_build}
skip_install = {[testenv:make-changelog]skip_install}
[testenv:make-changelog]
basepython = python3
depends =
check-changelog
description =
Generate a changelog from fragments using Towncrier
commands =
{envpython} -m \
towncrier \
--version \
{posargs:'[UNRELEASED DRAFT]' --draft}
deps =
towncrier
-c{toxinidir}/docs/requirements.txt
isolated_build = true
skip_install = true
[testenv:clean]
description =
Clean the Git repo workdir
commands =
git clean -fxd \
-- \
bin/__pycache__/ \
build/ \
src/build/ \
src/*.egg-info/
git clean -iXd
deps =
isolated_build = true
skip_install = true
whitelist_externals =
git