Skip to content

Commit 1048d8d

Browse files
committed
feat: support building universal2/arm64 from x64_86 Python 3.8 (pypa#704)
1 parent 6c62f9e commit 1048d8d

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ What does it do?
2828
| CPython 3.5 || ||||||||
2929
| CPython 3.6 || ||||||||
3030
| CPython 3.7 || ||||||||
31-
| CPython 3.8 || ||||||||
31+
| CPython 3.8 || ||||||||
3232
| CPython 3.9 ||||||||||
3333
| PyPy 2.7 v7.3.3 || | ||| | | | |
3434
| PyPy 3.6 v7.3.3 || | ||| | | | |
@@ -48,7 +48,7 @@ Usage
4848

4949
| | Linux | macOS | Windows | Linux ARM |
5050
|-----------------|-------|-------|---------|--------------|
51-
| GitHub Actions |||| ✅¹ |
51+
| GitHub Actions |||| ✅¹ |
5252
| Azure Pipelines |||| |
5353
| Travis CI |||||
5454
| AppVeyor |||| |

cibuildwheel/macos.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -293,22 +293,20 @@ def setup_python(
293293
# https://github.com/python/cpython/blob/a5ed2fe0eedefa1649aa93ee74a0bafc8e628a10/Lib/_osx_support.py#L260
294294
env.setdefault("ARCHFLAGS", "-arch x86_64")
295295

296-
if python_configuration.version == "3.9":
297-
if python_configuration.identifier.endswith("x86_64"):
298-
# even on the macos11.0 Python installer, on the x86_64 side it's
299-
# compatible back to 10.9.
300-
env.setdefault("_PYTHON_HOST_PLATFORM", "macosx-10.9-x86_64")
301-
env.setdefault("ARCHFLAGS", "-arch x86_64")
302-
elif config_is_arm64:
296+
elif python_configuration.version not in {"3.6", "3.7"}:
297+
if config_is_arm64:
303298
# macOS 11 is the first OS with arm64 support, so the wheels
304299
# have that as a minimum.
305300
env.setdefault("_PYTHON_HOST_PLATFORM", "macosx-11.0-arm64")
306301
env.setdefault("ARCHFLAGS", "-arch arm64")
307302
elif config_is_universal2:
308-
if get_macos_version() < (10, 16):
309-
# we can do universal2 builds on macos 10.15, but we need to
310-
# set ARCHFLAGS otherwise CPython sets it to `-arch x86_64`
311-
env.setdefault("ARCHFLAGS", "-arch arm64 -arch x86_64")
303+
env.setdefault("_PYTHON_HOST_PLATFORM", "macosx-10.9-universal2")
304+
env.setdefault("ARCHFLAGS", "-arch arm64 -arch x86_64")
305+
elif python_configuration.identifier.endswith("x86_64"):
306+
# even on the macos11.0 Python installer, on the x86_64 side it's
307+
# compatible back to 10.9.
308+
env.setdefault("_PYTHON_HOST_PLATFORM", "macosx-10.9-x86_64")
309+
env.setdefault("ARCHFLAGS", "-arch x86_64")
312310

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

cibuildwheel/resources/build-platforms.toml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,12 @@ python_configurations = [
4040
{ identifier = "cp35-macosx_x86_64", version = "3.5", url = "https://www.python.org/ftp/python/3.5.4/python-3.5.4-macosx10.6.pkg" },
4141
{ 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" },
4242
{ 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" },
43-
{ identifier = "cp38-macosx_x86_64", version = "3.8", url = "https://www.python.org/ftp/python/3.8.9/python-3.8.9-macosx10.9.pkg" },
44-
{ identifier = "cp39-macosx_x86_64", version = "3.9", url = "https://www.python.org/ftp/python/3.9.4/python-3.9.4-macos11.pkg" },
45-
{ identifier = "cp39-macosx_arm64", version = "3.9", url = "https://www.python.org/ftp/python/3.9.4/python-3.9.4-macos11.pkg" },
46-
{ identifier = "cp39-macosx_universal2", version = "3.9", url = "https://www.python.org/ftp/python/3.9.4/python-3.9.4-macos11.pkg" },
43+
{ 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" },
44+
{ identifier = "cp38-macosx_arm64", version = "3.8", url = "https://www.python.org/ftp/python/3.8.10/python-3.8.10-macosx10.9.pkg" },
45+
{ identifier = "cp38-macosx_universal2", version = "3.8", url = "https://www.python.org/ftp/python/3.8.10/python-3.8.10-macosx10.9.pkg" },
46+
{ identifier = "cp39-macosx_x86_64", version = "3.9", url = "https://www.python.org/ftp/python/3.9.5/python-3.9.5-macos11.pkg" },
47+
{ identifier = "cp39-macosx_arm64", version = "3.9", url = "https://www.python.org/ftp/python/3.9.5/python-3.9.5-macos11.pkg" },
48+
{ identifier = "cp39-macosx_universal2", version = "3.9", url = "https://www.python.org/ftp/python/3.9.5/python-3.9.5-macos11.pkg" },
4749
{ identifier = "pp27-macosx_x86_64", version = "2.7", url = "https://downloads.python.org/pypy/pypy2.7-v7.3.3-osx64.tar.bz2" },
4850
{ identifier = "pp36-macosx_x86_64", version = "3.6", url = "https://downloads.python.org/pypy/pypy3.6-v7.3.3-osx64.tar.bz2" },
4951
{ identifier = "pp37-macosx_x86_64", version = "3.7", url = "https://downloads.python.org/pypy/pypy3.7-v7.3.3-osx64.tar.bz2" },

0 commit comments

Comments
 (0)