summaryrefslogtreecommitdiff
path: root/Lib/_osx_support.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/_osx_support.py')
-rw-r--r--Lib/_osx_support.py30
1 files changed, 18 insertions, 12 deletions
diff --git a/Lib/_osx_support.py b/Lib/_osx_support.py
index b3aad56582..50b2d17e90 100644
--- a/Lib/_osx_support.py
+++ b/Lib/_osx_support.py
@@ -53,7 +53,7 @@ def _find_executable(executable, path=None):
def _read_output(commandstring):
- """Output from succesful command execution or None"""
+ """Output from successful command execution or None"""
# Similar to os.popen(commandstring, "r").read(),
# but without actually using os.popen because that
# function is not usable during python bootstrap.
@@ -152,7 +152,7 @@ def _find_appropriate_compiler(_config_vars):
# are not installed.
#
# Futhermore, the compiler that can be used varies between
- # Xcode releases. Upto Xcode 4 it was possible to use 'gcc-4.2'
+ # Xcode releases. Up to Xcode 4 it was possible to use 'gcc-4.2'
# as the compiler, after that 'clang' should be used because
# gcc-4.2 is either not present, or a copy of 'llvm-gcc' that
# miscompiles Python.
@@ -192,7 +192,7 @@ def _find_appropriate_compiler(_config_vars):
if cc != oldcc:
# Found a replacement compiler.
- # Modify config vars using new compiler, if not already explictly
+ # Modify config vars using new compiler, if not already explicitly
# overriden by an env variable, preserving additional arguments.
for cv in _COMPILER_CONFIG_VARS:
if cv in _config_vars and cv not in os.environ:
@@ -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]
@@ -274,7 +280,7 @@ def _check_for_unavailable_sdk(_config_vars):
# compile an extension using an SDK that is not present
# on the current machine it is better to not use an SDK
# than to fail. This is particularly important with
- # the standalong Command Line Tools alternative to a
+ # the standalone Command Line Tools alternative to a
# full-blown Xcode install since the CLT packages do not
# provide SDKs. If the SDK is not present, it is assumed
# that the header files and dev libs have been installed
@@ -378,7 +384,7 @@ def customize_config_vars(_config_vars):
compilers are present, i.e. when installing pure
Python dists. Customization of compiler paths
and detection of unavailable archs is deferred
- until the first extention module build is
+ until the first extension module build is
requested (in distutils.sysconfig.customize_compiler).
Currently called from distutils.sysconfig