3
3
The main GitHub workflow where this script is used:
4
4
https://github.com/mypyc/mypy_mypyc-wheels/blob/master/.github/workflows/build.yml
5
5
6
- This uses cibuildwheel (https://github.com/pypa/cibuildwheel) to
7
- build the wheels.
6
+ This uses cibuildwheel (https://github.com/pypa/cibuildwheel) to build the wheels.
8
7
9
8
Usage:
10
9
11
- build_wheel_ci.py --python-version <python-version> \
12
- --output-dir <dir>
10
+ build_wheel.py --python-version <python-version> --output-dir <dir>
13
11
14
12
Wheels for the given Python version will be created in the given directory.
15
13
Python version is in form "39".
18
16
19
17
You can test locally by using --extra-opts. macOS example:
20
18
21
- mypy/misc/build_wheel_ci.py --python-version 39 --output-dir out --extra-opts="--platform macos"
22
-
23
- Other supported values for platform: linux, windows
19
+ mypy/misc/build_wheel.py --python-version 39 --output-dir out --extra-opts="--platform macos"
24
20
"""
25
21
26
22
import argparse
@@ -39,13 +35,13 @@ def create_environ(python_version: str) -> Dict[str, str]:
39
35
"""Set up environment variables for cibuildwheel."""
40
36
env = os .environ .copy ()
41
37
42
- env ['CIBW_BUILD' ] = "cp{}-*" . format ( python_version )
38
+ env ['CIBW_BUILD' ] = f "cp{ python_version } -*"
43
39
44
40
# Don't build 32-bit wheels
45
41
env ['CIBW_SKIP' ] = "*-manylinux_i686 *-win32"
46
42
47
43
# Apple Silicon support
48
- # When cross-compiling on Intel, it is not possible to test arm64 and
44
+ # When cross-compiling on Intel, it is not possible to test arm64 and
49
45
# the arm64 part of a universal2 wheel. Warnings will be silenced with
50
46
# following CIBW_TEST_SKIP
51
47
env ['CIBW_ARCHS_MACOS' ] = "x86_64 arm64"
@@ -56,20 +52,15 @@ def create_environ(python_version: str) -> Dict[str, str]:
56
52
# mypy's isolated builds don't specify the requirements mypyc needs, so install
57
53
# requirements and don't use isolated builds. we need to use build-requirements.txt
58
54
# with recent mypy commits to get stub packages needed for compilation.
59
- #
60
- # TODO: remove use of mypy-requirements.txt once we no longer need to support
61
- # building pre modular typeshed releases
62
55
env ['CIBW_BEFORE_BUILD' ] = """
63
- pip install -r {package}/mypy-requirements.txt &&
64
- (pip install -r {package}/build-requirements.txt || true)
56
+ pip install -r {package}/build-requirements.txt
65
57
""" .replace ('\n ' , ' ' )
66
58
67
59
# download a copy of clang to use to compile on linux. this was probably built in 2018,
68
60
# speeds up compilation 2x
69
61
env ['CIBW_BEFORE_BUILD_LINUX' ] = """
70
62
(cd / && curl -L %s | tar xzf -) &&
71
- pip install -r {package}/mypy-requirements.txt &&
72
- (pip install -r {package}/build-requirements.txt || true)
63
+ pip install -r {package}/build-requirements.txt
73
64
""" .replace ('\n ' , ' ' ) % LLVM_URL
74
65
75
66
# the double negative is counterintuitive, https://github.com/pypa/pip/issues/5735
@@ -128,8 +119,7 @@ def main() -> None:
128
119
output_dir = args .output_dir
129
120
extra_opts = args .extra_opts
130
121
environ = create_environ (python_version )
131
- script = 'python -m cibuildwheel {} --output-dir {} {}' .format (extra_opts , output_dir ,
132
- ROOT_DIR )
122
+ script = f'python -m cibuildwheel { extra_opts } --output-dir { output_dir } { ROOT_DIR } '
133
123
subprocess .check_call (script , shell = True , env = environ )
134
124
135
125
0 commit comments