Skip to content

Commit 11a24d9

Browse files
committed
feat: support building universal2/arm64 from x64_86 Python 3.8
1 parent 5b22fc6 commit 11a24d9

File tree

3 files changed

+20
-21
lines changed

3 files changed

+20
-21
lines changed

README.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,15 @@ What does it do?
2323
----------------
2424

2525
| | macOS Intel | macOS Apple Silicon | Windows 64bit | Windows 32bit | manylinux x86_64 | manylinux i686 | manylinux aarch64 | manylinux ppc64le | manylinux s390x |
26-
|---|---|---|---|---|---|---|---|---|---|
27-
| CPython 3.6 || N/A ||||||||
28-
| CPython 3.7 || N/A ||||||||
29-
| CPython 3.8 || N/A¹ ||||||||
30-
| CPython 3.9 ||||||||||
31-
| CPython 3.10² ||||||||||
32-
| PyPy 3.7 v7.3 || N/A || N/A ||| | N/A | N/A |
26+
|---------------|----|-----|-----|-----|----|-----|----|-----|-----|
27+
| CPython 3.6 || N/A |||| || | |
28+
| CPython 3.7 || N/A |||| || | |
29+
| CPython 3.8 || |||| || | |
30+
| CPython 3.9 || |||| || | |
31+
| CPython 3.10¹ || |||| || | |
32+
| PyPy 3.7 v7.3 || N/A || N/A |||| N/A | N/A |
3333

34-
<sup>¹ CPython 3.8's final binary release has experimental Universal2 support, but does not support macOS 10.x, so this is not currently available.</sup><br>
35-
<sup>² Available as a prerelease under a [flag](https://cibuildwheel.readthedocs.io/en/stable/options/#prerelease-pythons)</sup><br>
34+
<sup>¹ Available as a prerelease under a [flag](https://cibuildwheel.readthedocs.io/en/stable/options/#prerelease-pythons)</sup><br>
3635

3736
- Builds manylinux, macOS 10.9+, and Windows wheels for CPython and PyPy
3837
- Works on GitHub Actions, Azure Pipelines, Travis CI, AppVeyor, CircleCI, and GitLab CI
@@ -48,7 +47,7 @@ Usage
4847

4948
| | Linux | macOS | Windows | Linux ARM |
5049
|-----------------|-------|-------|---------|--------------|
51-
| GitHub Actions |||| ✅¹ |
50+
| GitHub Actions |||| ✅¹ |
5251
| Azure Pipelines |||| |
5352
| Travis CI || |||
5453
| AppVeyor |||| |

cibuildwheel/macos.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -270,22 +270,20 @@ def setup_python(
270270
config_is_arm64 = python_configuration.identifier.endswith("arm64")
271271
config_is_universal2 = python_configuration.identifier.endswith("universal2")
272272

273-
if python_configuration.version not in {"3.6", "3.7", "3.8"}:
274-
if python_configuration.identifier.endswith("x86_64"):
275-
# even on the macos11.0 Python installer, on the x86_64 side it's
276-
# compatible back to 10.9.
277-
env.setdefault("_PYTHON_HOST_PLATFORM", "macosx-10.9-x86_64")
278-
env.setdefault("ARCHFLAGS", "-arch x86_64")
279-
elif config_is_arm64:
273+
if python_configuration.version not in {"3.6", "3.7"}:
274+
if config_is_arm64:
280275
# macOS 11 is the first OS with arm64 support, so the wheels
281276
# have that as a minimum.
282277
env.setdefault("_PYTHON_HOST_PLATFORM", "macosx-11.0-arm64")
283278
env.setdefault("ARCHFLAGS", "-arch arm64")
284279
elif config_is_universal2:
285-
if get_macos_version() < (10, 16):
286-
# we can do universal2 builds on macos 10.15, but we need to
287-
# set ARCHFLAGS otherwise CPython sets it to `-arch x86_64`
288-
env.setdefault("ARCHFLAGS", "-arch arm64 -arch x86_64")
280+
env.setdefault("_PYTHON_HOST_PLATFORM", "macosx-10.9-universal2")
281+
env.setdefault("ARCHFLAGS", "-arch arm64 -arch x86_64")
282+
elif python_configuration.identifier.endswith("x86_64"):
283+
# even on the macos11.0 Python installer, on the x86_64 side it's
284+
# compatible back to 10.9.
285+
env.setdefault("_PYTHON_HOST_PLATFORM", "macosx-10.9-x86_64")
286+
env.setdefault("ARCHFLAGS", "-arch x86_64")
289287

290288
building_arm64 = config_is_arm64 or config_is_universal2
291289
if building_arm64 and get_macos_version() < (10, 16) and "SDKROOT" not in env:

cibuildwheel/resources/build-platforms.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ python_configurations = [
3535
{ identifier = "cp36-macosx_x86_64", version = "3.6", url = "https://www.python.org/ftp/python/3.6.8/python-3.6.8-macosx10.9.pkg" },
3636
{ identifier = "cp37-macosx_x86_64", version = "3.7", url = "https://www.python.org/ftp/python/3.7.9/python-3.7.9-macosx10.9.pkg" },
3737
{ identifier = "cp38-macosx_x86_64", version = "3.8", url = "https://www.python.org/ftp/python/3.8.10/python-3.8.10-macosx10.9.pkg" },
38+
{ identifier = "cp38-macosx_arm64", version = "3.8", url = "https://www.python.org/ftp/python/3.8.10/python-3.8.10-macosx10.9.pkg" },
39+
{ identifier = "cp38-macosx_universal2", version = "3.8", url = "https://www.python.org/ftp/python/3.8.10/python-3.8.10-macosx10.9.pkg" },
3840
{ identifier = "cp39-macosx_x86_64", version = "3.9", url = "https://www.python.org/ftp/python/3.9.5/python-3.9.5-macos11.pkg" },
3941
{ identifier = "cp39-macosx_arm64", version = "3.9", url = "https://www.python.org/ftp/python/3.9.5/python-3.9.5-macos11.pkg" },
4042
{ identifier = "cp39-macosx_universal2", version = "3.9", url = "https://www.python.org/ftp/python/3.9.5/python-3.9.5-macos11.pkg" },

0 commit comments

Comments
 (0)