/
tox.ini
189 lines (167 loc) · 4.43 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
[tox]
envlist = python
minversion = 3.13.0
requires =
setuptools >= 40.9.0
pip >= 19.0.3
# tox-venv >= 0.4.0
isolated_build = true
[testenv]
isolated_build = true
usedevelop = false
deps =
pytest; python_version != "3.5" or system_platform != "darwin"
pytest<5.4; python_version == "3.5" and system_platform == "darwin"
pytest-xdist
commands =
{envpython} -m pytest {posargs:}
[testenv:test-binary-dists]
skip_install = true
commands_pre =
pip install \
--only-binary ansible-pylibssh \
-f {env:PEP517_OUT_DIR} \
ansible-pylibssh
setenv =
{[dists]setenv}
[testenv:test-source-dists]
skip_install = true
commands_pre =
pip install \
--no-binary ansible-pylibssh \
-f {env:PEP517_OUT_DIR} \
ansible-pylibssh
setenv =
{[dists]setenv}
[dists]
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 {posargs:} pyca/cryptography-manylinux1:x86_64 /io/build-scripts/build-manylinux-wheels.sh 0.9.3
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