Currently the variable MACOSX_DEPLOYMENT_TARGET was being set to 10.7 without regard to the CPU. This does not work because building a binary that targets the Mac OS 10.7 SDK is not possible on PowerPC. This value also prevents the building of an ARM native version for ARM based Macs. So we decide with architecture to use by looking at the CPU of the computer when on Darwin (Mac OS).
I would like some feedback on if this patch looks good or if there a problem I'm not seeing. Thank you. --- lib-python/2.7/distutils/sysconfig_pypy.py | 28 +++++++++++++++------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/lib-python/2.7/distutils/sysconfig_pypy.py b/lib-python/2.7/distutils/sysconfig_pypy.py index ec9f5a31db..61ab3d4f7c 100644 --- a/lib-python/2.7/distutils/sysconfig_pypy.py +++ b/lib-python/2.7/distutils/sysconfig_pypy.py @@ -75,18 +75,28 @@ def _init_posix(): g['VERSION'] = get_python_version() if sys.platform[:6] == "darwin": - import platform - if platform.machine() == 'i386': - if platform.architecture()[0] == '32bit': - arch = 'i386' - else: - arch = 'x86_64' + _, _, _, kernel_string, _, = os.uname() + begin = kernel_string.find("_") + 1 # position of the architecture string + arch = kernel_string[begin:] + arch = arch.lower() + + if "arm64" in arch: + arch = "arm64" + g['MACOSX_DEPLOYMENT_TARGET'] = '11.0' + elif "x86_64" in arch: + arch = "x86_64" + g['MACOSX_DEPLOYMENT_TARGET'] = '10.5' + elif "i386" in arch: + arch = "i386" + g['MACOSX_DEPLOYMENT_TARGET'] = '10.4' + elif "ppc" in arch: + arch = "ppc" + g['MACOSX_DEPLOYMENT_TARGET'] = '10.1' else: - # just a guess - arch = platform.machine() + raise Exception("Error in sysconfig_pypy.py: unknown architecture encountered: " + arch) + g['LDSHARED'] += ' -undefined dynamic_lookup' g['CC'] += ' -arch %s' % (arch,) - g['MACOSX_DEPLOYMENT_TARGET'] = '10.7' # pypy only: give us control over the ABI tag in a wheel name if '__pypy__' in sys.builtin_module_names: -- 2.24.3 (Apple Git-128) _______________________________________________ pypy-dev mailing list pypy-dev@python.org https://mail.python.org/mailman/listinfo/pypy-dev