summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNed Deily <nad@acm.org>2013-10-25 23:01:42 (GMT)
committerNed Deily <nad@acm.org>2013-10-25 23:01:42 (GMT)
commit7c5ba45fd87443f3bc50e6dd486fc88704a2428a (patch)
tree007f98e85b66bfc3d0193bed7659dfa46a7adaa9
parente6ef70237df8e49423ff627044a5a4d1a9643c16 (diff)
downloadcpython-7c5ba45fd87443f3bc50e6dd486fc88704a2428a.zip
cpython-7c5ba45fd87443f3bc50e6dd486fc88704a2428a.tar.gz
cpython-7c5ba45fd87443f3bc50e6dd486fc88704a2428a.tar.bz2
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.
-rw-r--r--Lib/_osx_support.py20
-rw-r--r--Misc/NEWS4
2 files changed, 17 insertions, 7 deletions
diff --git a/Lib/_osx_support.py b/Lib/_osx_support.py
index 42a8ebb..5a0b71e 100644
--- a/Lib/_osx_support.py
+++ b/Lib/_osx_support.py
@@ -235,13 +235,19 @@ def _remove_unsupported_archs(_config_vars):
if re.search('-arch\s+ppc', _config_vars['CFLAGS']) is not None:
# NOTE: Cannot use subprocess here because of bootstrap
# issues when building Python itself
- status = os.system("'%s' -arch ppc -x c /dev/null 2>/dev/null"%(
- _config_vars['CC'].replace("'", "'\"'\"'"),))
- # The Apple compiler drivers return status 255 if no PPC
- if (status >> 8) == 255:
- # Compiler doesn't support PPC, remove the related
- # '-arch' flags if not explicitly overridden by an
- # environment variable
+ status = os.system(
+ """echo 'int main{};' | """
+ """'%s' -c -arch ppc -x c -o /dev/null /dev/null 2>/dev/null"""
+ %(_config_vars['CC'].replace("'", "'\"'\"'"),))
+ if status:
+ # The compile failed for some reason. Because of differences
+ # 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:
if cv in _config_vars and cv not in os.environ:
flags = _config_vars[cv]
diff --git a/Misc/NEWS b/Misc/NEWS
index 3b98031..b341c5b 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -253,6 +253,10 @@ Library
existing directory caused mkstemp and related APIs to fail instead of
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.
+
Tools/Demos
-----------