@@ -235,13 +235,19 @@ def _remove_unsupported_archs(_config_vars):
235235 if re .search ('-arch\s+ppc' , _config_vars ['CFLAGS' ]) is not None :
236236 # NOTE: Cannot use subprocess here because of bootstrap
237237 # issues when building Python itself
238- status = os .system ("'%s' -arch ppc -x c /dev/null 2>/dev/null" % (
239- _config_vars ['CC' ].replace ("'" , "'\" '\" '" ),))
240- # The Apple compiler drivers return status 255 if no PPC
241- if (status >> 8 ) == 255 :
242- # Compiler doesn't support PPC, remove the related
243- # '-arch' flags if not explicitly overridden by an
244- # environment variable
238+ status = os .system (
239+ """echo 'int main{};' | """
240+ """'%s' -c -arch ppc -x c -o /dev/null /dev/null 2>/dev/null"""
241+ % (_config_vars ['CC' ].replace ("'" , "'\" '\" '" ),))
242+ if status :
243+ # The compile failed for some reason. Because of differences
244+ # across Xcode and compiler versions, there is no reliable way
245+ # to be sure why it failed. Assume here it was due to lack of
246+ # PPC support and remove the related '-arch' flags from each
247+ # config variables not explicitly overriden by an environment
248+ # variable. If the error was for some other reason, we hope the
249+ # failure will show up again when trying to compile an extension
250+ # module.
245251 for cv in _UNIVERSAL_CONFIG_VARS :
246252 if cv in _config_vars and cv not in os .environ :
247253 flags = _config_vars [cv ]
0 commit comments