(_config_vars)
return _config_vars
Remove any unsupported archs from config vars
Remove any unsupported archs from config vars
Remove any unsupported archs from config vars
def _remove_unsupported_archs(_config_vars):
    """Remove any unsupported archs from config vars"""
    # Different Xcode releases support different sets for '-arch'
    # flags. In particular, Xcode 4.x no longer supports the
    # PPC architectures.
    #
    # This code automatically removes '-arch ppc' and '-arch ppc64'
    # when these are not supported. That makes it possible to
    # build extensions on OSX 10.7 and later with the prebuilt
    # 32-bit installer on the python.org website.

    # skip checks if the compiler was overridden with a CC env variable
    if 'CC' in os.environ:
        return _config_vars

    if re.search(r'-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(
            """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 overridden 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]
                    flags = re.sub(r'-arch\s+ppc\w*\s', ' ', flags)
                    _save_modified_value(_config_vars, cv, flags)

    return _config_vars
def _remove_unsupported_archs ( _config_vars ) : # Different Xcode releases support different sets for '-arch' # flags. In particular, Xcode 4.x no longer supports the # PPC architectures. # # This code automatically removes '-arch ppc' and '-arch ppc64' # when these are not supported. That makes it possible to # build extensions on OSX 10.7 and later with the prebuilt # 32-bit installer on the python.org website. # skip checks if the compiler was overridden with a CC env variable if 'CC' in os . environ : return _config_vars if re . search ( r'-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 ( """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 overridden 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 ] flags = re . sub ( r'-arch\s+ppc\w*\s' , ' ' , flags ) _save_modified_value ( _config_vars , cv , flags ) return _config_vars