diff options
author | Ned Deily <nad@acm.org> | 2013-10-19 04:09:56 (GMT) |
---|---|---|
committer | Ned Deily <nad@acm.org> | 2013-10-19 04:09:56 (GMT) |
commit | 87adb6ef38393932cbab3a1ec3769bafc7d740e2 (patch) | |
tree | ab2e933a355c7eed268eb213de8d9886070cd6ae /Lib/_osx_support.py | |
parent | ea41d5f27c8d4b8c546a078d190b131d6c9c2fd7 (diff) | |
download | cpython-87adb6ef38393932cbab3a1ec3769bafc7d740e2.zip cpython-87adb6ef38393932cbab3a1ec3769bafc7d740e2.tar.gz cpython-87adb6ef38393932cbab3a1ec3769bafc7d740e2.tar.bz2 |
Issue #14499: Fix several problems with OS X universal build support:
1. ppc arch detection for extension module builds broke with Xcode 5
2. ppc arch detection in configure did not work on OS X 10.4
3. -sysroot and -arch flags were unnecessarily duplicated
4. there was no obvious way to configure an intel-32 only build.
Diffstat (limited to 'Lib/_osx_support.py')
-rw-r--r-- | Lib/_osx_support.py | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/Lib/_osx_support.py b/Lib/_osx_support.py index 3c11943..40fc78b 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] |