Skip to content

Commit eeafe6b

Browse files
authored
Fix build_wheel script nits (#11312)
Co-authored-by: hauntsaninja <>
1 parent eba24b4 commit eeafe6b

File tree

1 file changed

+8
-18
lines changed

1 file changed

+8
-18
lines changed

misc/build_wheel.py

+8-18
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,11 @@
33
The main GitHub workflow where this script is used:
44
https://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
98
Usage:
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
1412
Wheels for the given Python version will be created in the given directory.
1513
Python version is in form "39".
@@ -18,9 +16,7 @@
1816
1917
You 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

2622
import 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"
@@ -56,20 +52,15 @@ def create_environ(python_version: str) -> Dict[str, str]:
5652
# mypy's isolated builds don't specify the requirements mypyc needs, so install
5753
# requirements and don't use isolated builds. we need to use build-requirements.txt
5854
# 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
6255
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
6557
""".replace('\n', ' ')
6658

6759
# download a copy of clang to use to compile on linux. this was probably built in 2018,
6860
# speeds up compilation 2x
6961
env['CIBW_BEFORE_BUILD_LINUX'] = """
7062
(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
7364
""".replace('\n', ' ') % LLVM_URL
7465

7566
# the double negative is counterintuitive, https://github.com/pypa/pip/issues/5735
@@ -128,8 +119,7 @@ def main() -> None:
128119
output_dir = args.output_dir
129120
extra_opts = args.extra_opts
130121
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}'
133123
subprocess.check_call(script, shell=True, env=environ)
134124

135125

0 commit comments

Comments
 (0)