33The main GitHub workflow where this script is used:
44https://github.com/mypyc/mypy_mypyc-wheels/blob/master/.github/workflows/build.yml
55
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.
87
98Usage:
109
11- build_wheel_ci.py --python-version <python-version> \
12- --output-dir <dir>
10+ build_wheel.py --python-version <python-version> --output-dir <dir>
1311
1412Wheels for the given Python version will be created in the given directory.
1513Python version is in form "39".
1816
1917You can test locally by using --extra-opts. macOS example:
2018
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"
2420"""
2521
2622import argparse
@@ -39,13 +35,13 @@ def create_environ(python_version: str) -> Dict[str, str]:
3935 """Set up environment variables for cibuildwheel."""
4036 env = os .environ .copy ()
4137
42- env ['CIBW_BUILD' ] = "cp{}-*" . format ( python_version )
38+ env ['CIBW_BUILD' ] = f "cp{ python_version } -*"
4339
4440 # Don't build 32-bit wheels
4541 env ['CIBW_SKIP' ] = "*-manylinux_i686 *-win32"
4642
4743 # 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
4945 # the arm64 part of a universal2 wheel. Warnings will be silenced with
5046 # following CIBW_TEST_SKIP
5147 env ['CIBW_ARCHS_MACOS' ] = "x86_64 arm64"
@@ -54,22 +50,16 @@ def create_environ(python_version: str) -> Dict[str, str]:
5450 env ['CIBW_BUILD_VERBOSITY' ] = '1'
5551
5652 # mypy's isolated builds don't specify the requirements mypyc needs, so install
57- # requirements and don't use isolated builds. we need to use build-requirements.txt
58- # 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
53+ # requirements and don't use isolated builds.
6254 env ['CIBW_BEFORE_BUILD' ] = """
63- pip install -r {package}/mypy-requirements.txt &&
64- (pip install -r {package}/build-requirements.txt || true)
55+ pip install -r {package}/mypy-requirements.txt
6556 """ .replace ('\n ' , ' ' )
6657
6758 # download a copy of clang to use to compile on linux. this was probably built in 2018,
6859 # speeds up compilation 2x
6960 env ['CIBW_BEFORE_BUILD_LINUX' ] = """
7061 (cd / && curl -L %s | tar xzf -) &&
71- pip install -r {package}/mypy-requirements.txt &&
72- (pip install -r {package}/build-requirements.txt || true)
62+ pip install -r {package}/mypy-requirements.txt
7363 """ .replace ('\n ' , ' ' ) % LLVM_URL
7464
7565 # the double negative is counterintuitive, https://github.com/pypa/pip/issues/5735
@@ -128,8 +118,7 @@ def main() -> None:
128118 output_dir = args .output_dir
129119 extra_opts = args .extra_opts
130120 environ = create_environ (python_version )
131- script = 'python -m cibuildwheel {} --output-dir {} {}' .format (extra_opts , output_dir ,
132- ROOT_DIR )
121+ script = f'python -m cibuildwheel { extra_opts } --output-dir { output_dir } { ROOT_DIR } '
133122 subprocess .check_call (script , shell = True , env = environ )
134123
135124
0 commit comments