forked from ansible/pylibssh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tox.ini
443 lines (403 loc) · 11.5 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
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
[tox]
envlist = python
minversion = 3.21.0
requires =
setuptools >= 40.9.0
pip >= 19.0.3
# tox-venv >= 0.4.0
isolated_build = true
[testenv:just-pytest]
allowlist_externals =
isolated_build = true
usedevelop = false
deps =
# NOTE: `coverage` is a transitive dep but we need a minimum version boundary
# NOTE: to get a version supporting `source_pkgs`.
coverage >= 5.3
pytest
pytest-cov
pytest-forked
pytest-xdist
passenv =
PYTHONPATH
commands_pre =
commands =
{envpython} -m \
pytest \
{tty:--color=yes} \
--no-cov \
{posargs:}
[testenv]
allowlist_externals =
{env:CATCHSEGV_BINARY:}
env
sh
isolated_build = true
usedevelop = false
deps =
coverage >= 5.3
Cython
expandvars
pytest
pytest-cov
pytest-forked
pytest-xdist
setenv =
ANSIBLE_PYLIBSSH_CYTHON_TRACING = {env:ANSIBLE_PYLIBSSH_CYTHON_TRACING:1}
CATCHSEGV_BINARY = {env:CATCHSEGV_BINARY:}
COVERAGE_PROCESS_START = {toxinidir}/.coveragerc
COV_CORE_CONFIG = {toxinidir}/.coveragerc
COV_CORE_DATAFILE = {toxinidir}/.coverage
COV_CORE_SOURCE =
PYTHONPATH = packaging/
SEGFAULT_SIGNALS = all
commands =
-{envpython} -m pep517_backend.cli translate-cython
{env:CATCHSEGV_BINARY:} {envpython} -m \
pytest \
{tty:--color=yes} \
--cov-config={toxinidir}/.coveragerc \
--cov={envsitepackagesdir}/pylibsshext \
{posargs:}
[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
install_command =
{[dists]install_command}
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 'funcsigs; python_version < "3.3"' \
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
install_command =
{[dists]install_command}
setenv =
{[dists]setenv}
[dists]
install_command =
env PIP_CONSTRAINT= \
{envpython} -m pip install {opts} {packages}
setenv =
{[testenv]setenv}
PEP517_OUT_DIR = {env:PEP517_OUT_DIR:{toxinidir}{/}dist}
PIP_CONSTRAINT = {toxinidir}/requirements-build.txt
[testenv:cleanup-dists]
allowlist_externals =
rm
description =
Wipe the the dists/ folder
usedevelop = false
skip_install = true
deps =
install_command =
{[dists]install_command}
setenv =
{[dists]setenv}
commands =
rm -rfv {env:PEP517_OUT_DIR}
[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 =
build ~= 0.9.0
install_command =
{[dists]install_command}
passenv =
PEP517_BUILD_ARGS
setenv =
{[dists]setenv}
commands =
{envpython} -m build \
--outdir '{env:PEP517_OUT_DIR}{/}' \
{posargs:{env:PEP517_BUILD_ARGS:}} \
'{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
install_command =
{[dists]install_command}
setenv =
{[dists]setenv}
commands =
env PIP_CONSTRAINT= \
{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
install_command =
{[dists]install_command}
setenv =
{[dists]setenv}
commands =
sh -c "\
{envpython} -m \
delocate.cmd.delocate_listdeps \
--all \
{posargs:'{env:PEP517_OUT_DIR}'/*.whl}"
sh -c "\
{envpython} -m \
delocate.cmd.delocate_wheel \
-v \
{posargs:'{env:PEP517_OUT_DIR}'/*.whl}"
sh -c "\
{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{1,2010,2014,_2_24,_2_28}-{x86_64,aarch64,ppc64le,s390x}
build-wheels-pip
delocate-macos-wheels
deps =
twine
install_command =
{[dists]install_command}
usedevelop = false
skip_install = true
setenv =
{[dists]setenv}
commands =
twine check --strict {env:PEP517_OUT_DIR}/*
[testenv:build-dists-manylinux{1,2010,2014,_2_24,_2_28}-{x86_64,aarch64,ppc64le,s390x}]
allowlist_externals =
{env:DOCKER_EXECUTABLE:docker}
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_CYTHON_TRACING \
ghcr.io/ansible/pylibssh-manylinux{env:MANYLINUX_VERSION_TAG}_{env:MANYLINUX_ARCH_TAG}:libssh-v{env:LIBSSH_VERSION:0.9.6} \
/io/build-scripts/build-manylinux-wheels.sh \
"manylinux{env:MANYLINUX_VERSION_TAG}_{env:MANYLINUX_ARCH_TAG}" \
{posargs:}
deps =
isolated_build = true
passenv =
# alternatively set `DOCKER_EXECUTABLE=podman` outside the container
DOCKER_EXECUTABLE
HOME
LIBSSH_VERSION
setenv =
{[testenv]setenv}
x86_64: MANYLINUX_ARCH_TAG = x86_64
aarch64: MANYLINUX_ARCH_TAG = aarch64
ppc64le: MANYLINUX_ARCH_TAG = ppc64le
s390x: MANYLINUX_ARCH_TAG = s390x
manylinux1: MANYLINUX_VERSION_TAG = 1
manylinux2010: MANYLINUX_VERSION_TAG = 2010
manylinux2014: MANYLINUX_VERSION_TAG = 2014
manylinux_2_24: MANYLINUX_VERSION_TAG = _2_24
manylinux_2_28: MANYLINUX_VERSION_TAG = _2_28
skip_install = true
[testenv:lint]
basepython = python3
commands =
{envpython} -m pre_commit run --show-diff-on-failure {posargs:--all-files}
# Print out the advice on 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]
allowlist_externals =
git
basepython = python3
depends =
make-changelog
deps =
-r{toxinidir}/docs/requirements.txt
# FIXME: re-enable the "-r" + "-c" paradigm once the pip bug is fixed.
# Ref: https://github.com/pypa/pip/issues/9243
# -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} -Im sphinx \
{posargs:\
-j auto \
-b {env:SPHINX_BUILDER:html} \
{tty:--color} \
-a \
-n \
-W --keep-going \
-d "{temp_dir}/.doctrees" \
. \
{env:SPHINX_BUILD_OUTPUT_DIRECTORY:"{envdir}/docs_out"} \
}
# 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 -Im http.server --directory \
\N\{QUOTATION MARK\}\{docs_dir\}\N\{QUOTATION MARK\} 0\n\n" +\
"=" * 120)'
changedir = {toxinidir}/docs
isolated_build = true
passenv =
READTHEDOCS*
SPHINX_BUILDER
SPHINX_BUILD_OUTPUT_DIRECTORY
SSH_AUTH_SOCK
setenv =
# NOTE: `pip` vendors deprecated `setuptools`' `pkg_resources`, causing
# NOTE: an unfixable deprecation error, so it's suppressed here. Older
# NOTE: `towncrier` versions hit it too. Some `sphinxcontrib` namespace
# NOTE: extensions haven't yet been upgraded to using PEP 420 either.
# NOTE: Also, one of the warnings comes from the `click-default-group` build:
PYTHONWARNINGS = error,once:pkg_resources is deprecated as an API.:DeprecationWarning:pip._internal.metadata.importlib._envs,once:pkg_resources is deprecated as an API.:DeprecationWarning:setuptools.command.test,once:pkg_resources is deprecated as an API.:DeprecationWarning:towncrier._settings.load,once:Deprecated call to `pkg_resources.declare_namespace('sphinxcontrib')`.:DeprecationWarning,once:setup.py install is deprecated.:
skip_install = true
[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}
envdir = {[testenv:make-changelog]envdir}
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. Getting an
unreleased changelog preview does not require extra arguments.
When invoking to update the changelog, pass the desired version as an
argument after `--`. For example, `tox -e {envname} -- 1.3.2`.
envdir = {toxworkdir}/changelog
commands =
{envpython} -m \
towncrier build \
--version \
{posargs:'[UNRELEASED DRAFT]' --draft}
deps =
-r{toxinidir}/docs/requirements.txt
# FIXME: re-enable the "-r" + "-c" paradigm once the pip bug is fixed.
# Ref: https://github.com/pypa/pip/issues/9243
# towncrier
# -r{toxinidir}/docs/requirements.in
# -c{toxinidir}/docs/requirements.txt
isolated_build = true
skip_install = true
[testenv:draft-changelog]
basepython = {[testenv:make-changelog]basepython}
description =
Print out the Towncrier-managed change notes
draft for the next release to stdout
commands =
# NOTE: `sh` invocation is required to suppress stderr from
# NOTE: towncrier since it does not have own CLI flags for
# NOTE: doing this.
sh -c "2>/dev/null \
{envpython} -m \
towncrier.build \
--version '[UNRELEASED DRAFT]' \
--draft"
envdir = {[testenv:make-changelog]envdir}
deps =
{[testenv:make-changelog]deps}
isolated_build = {[testenv:make-changelog]isolated_build}
skip_install = {[testenv:make-changelog]skip_install}
[testenv:clean]
allowlist_externals =
git
description =
Clean the Git repo workdir
commands =
git clean -fxd \
-- \
build/ \
packaging/__pycache__/ \
src/build/ \
src/*.egg-info/
git clean -iXd
deps =
isolated_build = true
skip_install = true