Commit b9d65ed8 authored by Ned Deily's avatar Ned Deily

Issue #19400: Prevent extension module build failures with Xcode 5 on OS X

10.8+ when using a universal Python that included a PPC architecture,
such as with a python.org 32-bit-only binary installer.
parent 2fc6181a
...@@ -235,13 +235,19 @@ def _remove_unsupported_archs(_config_vars): ...@@ -235,13 +235,19 @@ def _remove_unsupported_archs(_config_vars):
if re.search('-arch\s+ppc', _config_vars['CFLAGS']) is not None: if re.search('-arch\s+ppc', _config_vars['CFLAGS']) is not None:
# NOTE: Cannot use subprocess here because of bootstrap # NOTE: Cannot use subprocess here because of bootstrap
# issues when building Python itself # issues when building Python itself
status = os.system("'%s' -arch ppc -x c /dev/null 2>/dev/null"%( status = os.system(
_config_vars['CC'].replace("'", "'\"'\"'"),)) """echo 'int main{};' | """
# The Apple compiler drivers return status 255 if no PPC """'%s' -c -arch ppc -x c -o /dev/null /dev/null 2>/dev/null"""
if (status >> 8) == 255: %(_config_vars['CC'].replace("'", "'\"'\"'"),))
# Compiler doesn't support PPC, remove the related if status:
# '-arch' flags if not explicitly overridden by an # The compile failed for some reason. Because of differences
# environment variable # across Xcode and compiler versions, there is no reliable way
# to be sure why it failed. Assume here it was due to lack of
# PPC support and remove the related '-arch' flags from each
# config variables not explicitly overriden by an environment
# variable. If the error was for some other reason, we hope the
# failure will show up again when trying to compile an extension
# module.
for cv in _UNIVERSAL_CONFIG_VARS: for cv in _UNIVERSAL_CONFIG_VARS:
if cv in _config_vars and cv not in os.environ: if cv in _config_vars and cv not in os.environ:
flags = _config_vars[cv] flags = _config_vars[cv]
......
...@@ -411,6 +411,10 @@ Library ...@@ -411,6 +411,10 @@ Library
existing directory caused mkstemp and related APIs to fail instead of existing directory caused mkstemp and related APIs to fail instead of
retrying. Report and fix by Vlad Shcherbina. retrying. Report and fix by Vlad Shcherbina.
- Issue #19400: Prevent extension module build failures with Xcode 5 on OS X
10.8+ when using a universal Python that included a PPC architecture,
such as with a python.org 32-bit-only binary installer.
C API C API
----- -----
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment