def get_archs(libname):
    """ Return architecture types from library `libname`

    Parameters
    ----------
    libname : str
        filename of binary for which to return arch codes

    Returns
    -------
    arch_names : frozenset
        Empty (frozen)set if no arch codes.  If not empty, contains one or more
        of 'ppc', 'ppc64', 'i386', 'x86_64'
    """
    if not exists(libname):
        raise RuntimeError(libname + " is not a file")
    try:
        stdout = back_tick(['lipo', '-info', libname])
    except RuntimeError:
        return frozenset()
    lines = [line.strip() for line in stdout.split('\n') if line.strip()]
    # For some reason, output from lipo -info on .a file generates this line
    if lines[0] == "input file {0} is not a fat file".format(libname):
        line = lines[1]
    else:
        assert len(lines) == 1
        line = lines[0]
    for reggie in (
        'Non-fat file: {0} is architecture: (.*)'.format(libname),
        'Architectures in the fat file: {0} are: (.*)'.format(libname)):
        reggie = re.compile(reggie)
        match = reggie.match(line)
        if not match is None:
            return frozenset(match.groups()[0].split(' '))
    raise ValueError("Unexpected output: '{0}' for {1}".format(
        stdout, libname))
def get_archs ( libname ) : if not exists ( libname ) : raise RuntimeError ( libname + " is not a file" ) try : stdout = back_tick ( [ 'lipo' , '-info' , libname ] ) except RuntimeError : return frozenset ( ) lines = [ line . strip ( ) for line in stdout . split ( '\n' ) if line . strip ( ) ] if lines [ 0 ] == "input file {0} is not a fat file" . format ( libname ) : line = lines [ 1 ] else : assert len ( lines ) == 1 line = lines [ 0 ] for reggie in ( 'Non-fat file: {0} is architecture: (.*)' . format ( libname ) , 'Architectures in the fat file: {0} are: (.*)' . format ( libname ) ) : reggie = re . compile ( reggie ) match = reggie . match ( line ) if not match is None : return frozenset ( match . groups ( ) [ 0 ] . split ( ' ' ) ) raise ValueError ( "Unexpected output: '{0}' for {1}" . format ( stdout , libname ) )
Return architecture types from library `libname`

    Parameters
    ----------
    libname : str
        filename of binary for which to return arch codes

    Returns
    -------
    arch_names : frozenset
        Empty (frozen)set if no arch codes.  If not empty, contains one or more
        of 'ppc', 'ppc64', 'i386', 'x86_64'