Skip to content

Commit f3e1680

Browse files
committed
refactor: identifiers in a file
1 parent 10c052b commit f3e1680

File tree

8 files changed

+260
-76
lines changed

8 files changed

+260
-76
lines changed

cibuildwheel/__main__.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
Unbuffered,
2525
detect_ci_provider,
2626
resources_dir,
27+
read_python_configs,
2728
)
2829

2930

@@ -219,6 +220,8 @@ def main() -> None:
219220

220221
manylinux_images[build_platform] = image
221222

223+
python_configs = read_python_configs(resources_dir / f"{platform}.toml")
224+
222225
build_options = BuildOptions(
223226
architectures=archs,
224227
package_dir=package_dir,
@@ -235,6 +238,7 @@ def main() -> None:
235238
environment=environment,
236239
dependency_constraints=dependency_constraints,
237240
manylinux_images=manylinux_images,
241+
python_configs=python_configs,
238242
)
239243

240244
# Python is buffering by default when running on the CI platforms, giving problems interleaving subprocess call output with unflushed calls to 'print'
@@ -306,13 +310,16 @@ def print_preamble(platform: str, build_options: BuildOptions) -> None:
306310
def print_build_identifiers(
307311
platform: str, build_selector: BuildSelector, architectures: List[Architecture]
308312
) -> None:
313+
314+
python_configs = read_python_configs(resources_dir / f"{platform}.toml")
315+
309316
python_configurations: List[Any] = []
310317
if platform == 'linux':
311-
python_configurations = cibuildwheel.linux.get_python_configurations(build_selector, architectures)
318+
python_configurations = cibuildwheel.linux.get_python_configurations(python_configs, build_selector, architectures)
312319
elif platform == 'windows':
313-
python_configurations = cibuildwheel.windows.get_python_configurations(build_selector)
320+
python_configurations = cibuildwheel.windows.get_python_configurations(python_configs, build_selector)
314321
elif platform == 'macos':
315-
python_configurations = cibuildwheel.macos.get_python_configurations(build_selector)
322+
python_configurations = cibuildwheel.macos.get_python_configurations(python_configs, build_selector)
316323

317324
for config in python_configurations:
318325
print(config.identifier)

cibuildwheel/linux.py

Lines changed: 8 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import textwrap
44
from os import PathLike
55
from pathlib import Path, PurePath
6-
from typing import List, NamedTuple, Union
6+
from typing import List, NamedTuple, Union, Dict
77

88
from .docker_container import DockerContainer
99
from .logger import log
@@ -24,42 +24,13 @@ def path(self):
2424

2525

2626
def get_python_configurations(
27-
build_selector: BuildSelector, architectures: List[Architecture]
27+
python_configs: List[Dict[str, str]],
28+
build_selector: BuildSelector,
29+
architectures: List[Architecture]
2830
) -> List[PythonConfiguration]:
29-
python_configurations = [
30-
PythonConfiguration(version='2.7', identifier='cp27-manylinux_x86_64', path_str='/opt/python/cp27-cp27m'),
31-
PythonConfiguration(version='2.7', identifier='cp27-manylinux_x86_64', path_str='/opt/python/cp27-cp27mu'),
32-
PythonConfiguration(version='3.5', identifier='cp35-manylinux_x86_64', path_str='/opt/python/cp35-cp35m'),
33-
PythonConfiguration(version='3.6', identifier='cp36-manylinux_x86_64', path_str='/opt/python/cp36-cp36m'),
34-
PythonConfiguration(version='3.7', identifier='cp37-manylinux_x86_64', path_str='/opt/python/cp37-cp37m'),
35-
PythonConfiguration(version='3.8', identifier='cp38-manylinux_x86_64', path_str='/opt/python/cp38-cp38'),
36-
PythonConfiguration(version='3.9', identifier='cp39-manylinux_x86_64', path_str='/opt/python/cp39-cp39'),
37-
PythonConfiguration(version='2.7', identifier='cp27-manylinux_i686', path_str='/opt/python/cp27-cp27m'),
38-
PythonConfiguration(version='2.7', identifier='cp27-manylinux_i686', path_str='/opt/python/cp27-cp27mu'),
39-
PythonConfiguration(version='3.5', identifier='cp35-manylinux_i686', path_str='/opt/python/cp35-cp35m'),
40-
PythonConfiguration(version='3.6', identifier='cp36-manylinux_i686', path_str='/opt/python/cp36-cp36m'),
41-
PythonConfiguration(version='3.7', identifier='cp37-manylinux_i686', path_str='/opt/python/cp37-cp37m'),
42-
PythonConfiguration(version='3.8', identifier='cp38-manylinux_i686', path_str='/opt/python/cp38-cp38'),
43-
PythonConfiguration(version='3.9', identifier='cp39-manylinux_i686', path_str='/opt/python/cp39-cp39'),
44-
PythonConfiguration(version='2.7', identifier='pp27-manylinux_x86_64', path_str='/opt/python/pp27-pypy_73'),
45-
PythonConfiguration(version='3.6', identifier='pp36-manylinux_x86_64', path_str='/opt/python/pp36-pypy36_pp73'),
46-
PythonConfiguration(version='3.7', identifier='pp37-manylinux_x86_64', path_str='/opt/python/pp37-pypy37_pp73'),
47-
PythonConfiguration(version='3.5', identifier='cp35-manylinux_aarch64', path_str='/opt/python/cp35-cp35m'),
48-
PythonConfiguration(version='3.6', identifier='cp36-manylinux_aarch64', path_str='/opt/python/cp36-cp36m'),
49-
PythonConfiguration(version='3.7', identifier='cp37-manylinux_aarch64', path_str='/opt/python/cp37-cp37m'),
50-
PythonConfiguration(version='3.8', identifier='cp38-manylinux_aarch64', path_str='/opt/python/cp38-cp38'),
51-
PythonConfiguration(version='3.9', identifier='cp39-manylinux_aarch64', path_str='/opt/python/cp39-cp39'),
52-
PythonConfiguration(version='3.5', identifier='cp35-manylinux_ppc64le', path_str='/opt/python/cp35-cp35m'),
53-
PythonConfiguration(version='3.6', identifier='cp36-manylinux_ppc64le', path_str='/opt/python/cp36-cp36m'),
54-
PythonConfiguration(version='3.7', identifier='cp37-manylinux_ppc64le', path_str='/opt/python/cp37-cp37m'),
55-
PythonConfiguration(version='3.8', identifier='cp38-manylinux_ppc64le', path_str='/opt/python/cp38-cp38'),
56-
PythonConfiguration(version='3.9', identifier='cp39-manylinux_ppc64le', path_str='/opt/python/cp39-cp39'),
57-
PythonConfiguration(version='3.5', identifier='cp35-manylinux_s390x', path_str='/opt/python/cp35-cp35m'),
58-
PythonConfiguration(version='3.6', identifier='cp36-manylinux_s390x', path_str='/opt/python/cp36-cp36m'),
59-
PythonConfiguration(version='3.7', identifier='cp37-manylinux_s390x', path_str='/opt/python/cp37-cp37m'),
60-
PythonConfiguration(version='3.8', identifier='cp38-manylinux_s390x', path_str='/opt/python/cp38-cp38'),
61-
PythonConfiguration(version='3.9', identifier='cp39-manylinux_s390x', path_str='/opt/python/cp39-cp39'),
62-
]
31+
32+
python_configurations = [PythonConfiguration(**item) for item in python_configs]
33+
6334

6435
# return all configurations whose arch is in our `architectures` list,
6536
# and match the build/skip rules
@@ -81,7 +52,7 @@ def build(options: BuildOptions) -> None:
8152
exit(2)
8253

8354
assert options.manylinux_images is not None
84-
python_configurations = get_python_configurations(options.build_selector, options.architectures)
55+
python_configurations = get_python_configurations(options.python_configs, options.build_selector, options.architectures)
8556
platforms = [
8657
('cp', 'manylinux_x86_64', options.manylinux_images['x86_64']),
8758
('cp', 'manylinux_i686', options.manylinux_images['i686']),

cibuildwheel/macos.py

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,20 +32,11 @@ class PythonConfiguration(NamedTuple):
3232
url: str
3333

3434

35-
def get_python_configurations(build_selector: BuildSelector) -> List[PythonConfiguration]:
36-
python_configurations = [
37-
# CPython
38-
PythonConfiguration(version='2.7', identifier='cp27-macosx_x86_64', url='https://www.python.org/ftp/python/2.7.18/python-2.7.18-macosx10.9.pkg'),
39-
PythonConfiguration(version='3.5', identifier='cp35-macosx_x86_64', url='https://www.python.org/ftp/python/3.5.4/python-3.5.4-macosx10.6.pkg'),
40-
PythonConfiguration(version='3.6', identifier='cp36-macosx_x86_64', url='https://www.python.org/ftp/python/3.6.8/python-3.6.8-macosx10.9.pkg'),
41-
PythonConfiguration(version='3.7', identifier='cp37-macosx_x86_64', url='https://www.python.org/ftp/python/3.7.9/python-3.7.9-macosx10.9.pkg'),
42-
PythonConfiguration(version='3.8', identifier='cp38-macosx_x86_64', url='https://www.python.org/ftp/python/3.8.7/python-3.8.7-macosx10.9.pkg'),
43-
PythonConfiguration(version='3.9', identifier='cp39-macosx_x86_64', url='https://www.python.org/ftp/python/3.9.1/python-3.9.1-macosx10.9.pkg'),
44-
# PyPy
45-
PythonConfiguration(version='2.7', identifier='pp27-macosx_x86_64', url='https://downloads.python.org/pypy/pypy2.7-v7.3.3-osx64.tar.bz2'),
46-
PythonConfiguration(version='3.6', identifier='pp36-macosx_x86_64', url='https://downloads.python.org/pypy/pypy3.6-v7.3.3-osx64.tar.bz2'),
47-
PythonConfiguration(version='3.7', identifier='pp37-macosx_x86_64', url='https://downloads.python.org/pypy/pypy3.7-v7.3.3-osx64.tar.bz2'),
48-
]
35+
def get_python_configurations(
36+
python_configs: List[Dict[str, str]],
37+
build_selector: BuildSelector) -> List[PythonConfiguration]:
38+
39+
python_configurations = [PythonConfiguration(**item) for item in python_configs]
4940

5041
# skip builds as required
5142
return [c for c in python_configurations if build_selector(c.identifier)]
@@ -204,7 +195,7 @@ def build(options: BuildOptions) -> None:
204195
before_all_prepared = prepare_command(options.before_all, project='.', package=options.package_dir)
205196
call([before_all_prepared], shell=True, env=env)
206197

207-
python_configurations = get_python_configurations(options.build_selector)
198+
python_configurations = get_python_configurations(options.python_configs, options.build_selector)
208199

209200
for config in python_configurations:
210201
log.build_start(config.identifier)

cibuildwheel/resources/linux.toml

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
[cp27-manylinux_x86_64]
2+
version="2.7"
3+
path_str="/opt/python/cp27-cp27m"
4+
5+
[cp35-manylinux_x86_64]
6+
version="3.5"
7+
path_str="/opt/python/cp35-cp35m"
8+
9+
[cp36-manylinux_x86_64]
10+
version="3.6"
11+
path_str="/opt/python/cp36-cp36m"
12+
13+
[cp37-manylinux_x86_64]
14+
version="3.7"
15+
path_str="/opt/python/cp37-cp37m"
16+
17+
[cp38-manylinux_x86_64]
18+
version="3.8"
19+
path_str="/opt/python/cp38-cp38"
20+
21+
[cp39-manylinux_x86_64]
22+
version="3.9"
23+
path_str="/opt/python/cp39-cp39"
24+
25+
[cp27-manylinux_i686]
26+
version="2.7"
27+
path_str="/opt/python/cp27-cp27m"
28+
29+
[cp35-manylinux_i686]
30+
version="3.5"
31+
path_str="/opt/python/cp35-cp35m"
32+
33+
[cp36-manylinux_i686]
34+
version="3.6"
35+
path_str="/opt/python/cp36-cp36m"
36+
37+
[cp37-manylinux_i686]
38+
version="3.7"
39+
path_str="/opt/python/cp37-cp37m"
40+
41+
[cp38-manylinux_i686]
42+
version="3.8"
43+
path_str="/opt/python/cp38-cp38"
44+
45+
[cp39-manylinux_i686]
46+
version="3.9"
47+
path_str="/opt/python/cp39-cp39"
48+
49+
[pp27-manylinux_x86_64]
50+
version="2.7"
51+
path_str="/opt/python/pp27-pypy_73"
52+
53+
[pp36-manylinux_x86_64]
54+
version="3.6"
55+
path_str="/opt/python/pp36-pypy36_pp73"
56+
57+
[pp37-manylinux_x86_64]
58+
version="3.7"
59+
path_str="/opt/python/pp37-pypy37_pp73"
60+
61+
[cp35-manylinux_aarch64]
62+
version="3.5"
63+
path_str="/opt/python/cp35-cp35m"
64+
65+
[cp36-manylinux_aarch64]
66+
version="3.6"
67+
path_str="/opt/python/cp36-cp36m"
68+
69+
[cp37-manylinux_aarch64]
70+
version="3.7"
71+
path_str="/opt/python/cp37-cp37m"
72+
73+
[cp38-manylinux_aarch64]
74+
version="3.8"
75+
path_str="/opt/python/cp38-cp38"
76+
77+
[cp39-manylinux_aarch64]
78+
version="3.9"
79+
path_str="/opt/python/cp39-cp39"
80+
81+
[cp35-manylinux_ppc64le]
82+
version="3.5"
83+
path_str="/opt/python/cp35-cp35m"
84+
85+
[cp36-manylinux_ppc64le]
86+
version="3.6"
87+
path_str="/opt/python/cp36-cp36m"
88+
89+
[cp37-manylinux_ppc64le]
90+
version="3.7"
91+
path_str="/opt/python/cp37-cp37m"
92+
93+
[cp38-manylinux_ppc64le]
94+
version="3.8"
95+
path_str="/opt/python/cp38-cp38"
96+
97+
[cp39-manylinux_ppc64le]
98+
version="3.9"
99+
path_str="/opt/python/cp39-cp39"
100+
101+
[cp35-manylinux_s390x]
102+
version="3.5"
103+
path_str="/opt/python/cp35-cp35m"
104+
105+
[cp36-manylinux_s390x]
106+
version="3.6"
107+
path_str="/opt/python/cp36-cp36m"
108+
109+
[cp37-manylinux_s390x]
110+
version="3.7"
111+
path_str="/opt/python/cp37-cp37m"
112+
113+
[cp38-manylinux_s390x]
114+
version="3.8"
115+
path_str="/opt/python/cp38-cp38"
116+
117+
[cp39-manylinux_s390x]
118+
version="3.9"
119+
path_str="/opt/python/cp39-cp39"

cibuildwheel/resources/macos.toml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
[cp27-macosx_x86_64]
2+
version="2.7"
3+
url="https://www.python.org/ftp/python/2.7.18/python-2.7.18-macosx10.9.pkg"
4+
5+
[cp35-macosx_x86_64]
6+
version="3.5"
7+
url="https://www.python.org/ftp/python/3.5.4/python-3.5.4-macosx10.6.pkg"
8+
9+
[cp36-macosx_x86_64]
10+
version="3.6"
11+
url="https://www.python.org/ftp/python/3.6.8/python-3.6.8-macosx10.9.pkg"
12+
13+
[cp37-macosx_x86_64]
14+
version="3.7"
15+
url="https://www.python.org/ftp/python/3.7.9/python-3.7.9-macosx10.9.pkg"
16+
17+
[cp38-macosx_x86_64]
18+
version="3.8"
19+
url="https://www.python.org/ftp/python/3.8.7/python-3.8.7-macosx10.9.pkg"
20+
21+
[cp39-macosx_x86_64]
22+
version="3.9"
23+
url="https://www.python.org/ftp/python/3.9.1/python-3.9.1-macosx10.9.pkg"
24+
25+
[pp27-macosx_x86_64]
26+
version="2.7"
27+
url="https://downloads.python.org/pypy/pypy2.7-v7.3.3-osx64.tar.bz2"
28+
29+
[pp36-macosx_x86_64]
30+
version="3.6"
31+
url="https://downloads.python.org/pypy/pypy3.6-v7.3.3-osx64.tar.bz2"
32+
33+
[pp37-macosx_x86_64]
34+
version="3.7"
35+
url="https://downloads.python.org/pypy/pypy3.7-v7.3.3-osx64.tar.bz2"
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
[cp27-win32]
2+
version="2.7.18"
3+
arch="32"
4+
5+
[cp27-win_amd64]
6+
version="2.7.18"
7+
arch="64"
8+
9+
[cp35-win32]
10+
version="3.5.4"
11+
arch="32"
12+
13+
[cp35-win_amd64]
14+
version="3.5.4"
15+
arch="64"
16+
17+
[cp36-win32]
18+
version="3.6.8"
19+
arch="32"
20+
21+
[cp36-win_amd64]
22+
version="3.6.8"
23+
arch="64"
24+
25+
[cp37-win32]
26+
version="3.7.9"
27+
arch="32"
28+
29+
[cp37-win_amd64]
30+
version="3.7.9"
31+
arch="64"
32+
33+
[cp38-win32]
34+
version="3.8.7"
35+
arch="32"
36+
37+
[cp38-win_amd64]
38+
version="3.8.7"
39+
arch="64"
40+
41+
[cp39-win32]
42+
version="3.9.1"
43+
arch="32"
44+
45+
[cp39-win_amd64]
46+
version="3.9.1"
47+
arch="64"
48+
49+
[pp27-win32]
50+
version="2.7"
51+
arch="32"
52+
url="https://downloads.python.org/pypy/pypy2.7-v7.3.3-win32.zip"
53+
54+
[pp36-win32]
55+
version="3.6"
56+
arch="32"
57+
url="https://downloads.python.org/pypy/pypy3.6-v7.3.3-win32.zip"
58+
59+
[pp37-win32]
60+
version="3.7"
61+
arch="32"
62+
url="https://downloads.python.org/pypy/pypy3.7-v7.3.3-win32.zip"

0 commit comments

Comments
 (0)