-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
bpo-41100: Support macOS 11 and Apple Silicon #22855
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
919efcc
69c39f3
3940c86
deda5f0
ea3c200
552bca8
e0c23a1
e637a77
02fb660
ba2f5a3
8e3b454
87c942b
515fbe6
eee5437
3a1d4f2
2f019f4
cec3da7
86b5cf3
d604cef
dde0ba4
7ac26c4
191a2d7
e6d195b
cfb02ba
003dae8
004ba4e
6019346
54576ab
6af77ab
b653df9
98af7b3
817d9bf
8684d9d
0b44610
36deb92
33d5710
c3113eb
587e53e
24ef276
e0614bc
e6478fa
3f72949
5daff99
6681261
b17a3d5
7e64e95
fef2e93
24eb0d0
296666b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -110,6 +110,26 @@ def _get_system_version(): | |
|
||
return _SYSTEM_VERSION | ||
|
||
_SYSTEM_VERSION_TUPLE = None | ||
def _get_system_version_tuple(): | ||
""" | ||
Return the macOS system version as a tuple | ||
|
||
The return value is safe to use to compare | ||
two version numbers. | ||
""" | ||
global _SYSTEM_VERSION_TUPLE | ||
if _SYSTEM_VERSION_TUPLE is None: | ||
osx_version = _get_system_version() | ||
if osx_version: | ||
try: | ||
_SYSTEM_VERSION_TUPLE = tuple(int(i) for i in osx_version.split('.')) | ||
except ValueError: | ||
_SYSTEM_VERSION_TUPLE = () | ||
|
||
return _SYSTEM_VERSION_TUPLE | ||
|
||
|
||
def _remove_original_values(_config_vars): | ||
"""Remove original unmodified values for testing""" | ||
# This is needed for higher-level cross-platform tests of get_platform. | ||
|
@@ -132,14 +152,18 @@ def _supports_universal_builds(): | |
# builds, in particular -isysroot and -arch arguments to the compiler. This | ||
# is in support of allowing 10.4 universal builds to run on 10.3.x systems. | ||
|
||
osx_version = _get_system_version() | ||
if osx_version: | ||
try: | ||
osx_version = tuple(int(i) for i in osx_version.split('.')) | ||
except ValueError: | ||
osx_version = '' | ||
osx_version = _get_system_version_tuple() | ||
return bool(osx_version >= (10, 4)) if osx_version else False | ||
|
||
def _supports_arm64_builds(): | ||
"""Returns True if arm64 builds are supported on this system""" | ||
# There are two sets of systems supporting macOS/arm64 builds: | ||
# 1. macOS 11 and later, unconditionally | ||
# 2. macOS 10.15 with Xcode 12.2 or later | ||
# For now the second category is ignored. | ||
osx_version = _get_system_version_tuple() | ||
return osx_version >= (11, 0) if osx_version else False | ||
|
||
|
||
def _find_appropriate_compiler(_config_vars): | ||
"""Find appropriate C compiler for extension module builds""" | ||
|
@@ -331,6 +355,12 @@ def compiler_fixup(compiler_so, cc_args): | |
except ValueError: | ||
break | ||
|
||
elif not _supports_arm64_builds(): | ||
# Look for "-arch arm64" and drop that | ||
for idx in range(len(compiler_so)): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. dang, looks like you're right There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This PR was merged over a year ago and has long since been released to the field. Please open a new issue on the bug tracker and, if possible, provide a PR. Otherwise, it will likely be forgotten about it. Thanks! |
||
if compiler_so[idx] == '-arch' and compiler_so[idx+1] == "arm64": | ||
del compiler_so[idx:idx+2] | ||
|
||
if 'ARCHFLAGS' in os.environ and not stripArch: | ||
# User specified different -arch flags in the environ, | ||
# see also distutils.sysconfig | ||
|
@@ -481,6 +511,8 @@ def get_platform_osx(_config_vars, osname, release, machine): | |
|
||
if len(archs) == 1: | ||
machine = archs[0] | ||
elif archs == ('arm64', 'x86_64'): | ||
machine = 'universal2' | ||
elif archs == ('i386', 'ppc'): | ||
machine = 'fat' | ||
elif archs == ('i386', 'x86_64'): | ||
|
Uh oh!
There was an error while loading. Please reload this page.