chrome/tools/build/mac/verify_dynamic_libraries.py
def verify_image_libraries(image_path, allowed_libraries, binary_path):
    """Verifies that the Mach-O image residing at |image_path| is only linked
    against dynamic libraries listed in |allowed_libraries|. The image does
    not have to link against everything that is allowed, but it cannot link
    against anything that is not allowed. Returns True if the image only
    links against allowed libraries, and otherwise returns False with an error
    printed.
    """
    output = subprocess.check_output(
        [binary_path + 'llvm-objdump', '--macho', '--dylibs-used', image_path])
    output = output.decode('utf8').strip()

    disallowed_libraries = []

    # Skip the first line of output, which is image_path.
    linked_libraries = output.split('\n')[1:]
    for linked_library in linked_libraries:
        # The line starts with a tab, followed by the image path, followed by
        # a space and then version information in parentheses.
        linked_library = linked_library.lstrip('\t')
        open_paren = linked_library.rindex('(')
        linked_library = linked_library[:open_paren - 1]

        if linked_library not in allowed_libraries:
            disallowed_libraries.append(linked_library)

    if not disallowed_libraries:
        return True

    print('{} linked against the following disallowed libraries:'.format(
        image_path),
          file=sys.stderr)
    for disallowed_library in disallowed_libraries:
        print('    {}'.format(disallowed_library), file=sys.stderr)

    return False
Verifies that the Mach-O image residing at |image_path| is only linked
    against dynamic libraries listed in |allowed_libraries|. The image does
    not have to link against everything that is allowed, but it cannot link
    against anything that is not allowed. Returns True if the image only
    links against allowed libraries, and otherwise returns False with an error
    printed.
    
Verifies that the Mach-O image residing at |image_path| is only linked
against dynamic libraries listed in |allowed_libraries|. The image does
not have to link against everything that is allowed, but it cannot link
against anything that is not allowed. Returns True if the image only
links against allowed libraries, and otherwise returns False with an error
printed.
Verifies that the Mach - O image residing at |image_path| is only linked against dynamic libraries listed in |allowed_libraries| . The image does not have to link against everything that is allowed but it cannot link against anything that is not allowed . Returns True if the image only links against allowed libraries and otherwise returns False with an error printed .
def verify_image_libraries(image_path, allowed_libraries, binary_path):
    output = subprocess.check_output(
        [binary_path + 'llvm-objdump', '--macho', '--dylibs-used', image_path])
    output = output.decode('utf8').strip()
    disallowed_libraries = []
    linked_libraries = output.split('\n')[1:]
    for linked_library in linked_libraries:
        linked_library = linked_library.lstrip('\t')
        open_paren = linked_library.rindex('(')
        linked_library = linked_library[:open_paren - 1]
        if linked_library not in allowed_libraries:
            disallowed_libraries.append(linked_library)
    if not disallowed_libraries:
        return True
    print('{} linked against the following disallowed libraries:'.format(
        image_path),
          file=sys.stderr)
    for disallowed_library in disallowed_libraries:
        print('    {}'.format(disallowed_library), file=sys.stderr)
    return False
def verify_image_libraries ( image_path , allowed_libraries , binary_path ) : output = subprocess . check_output ( [ binary_path + 'llvm-objdump' , '--macho' , '--dylibs-used' , image_path ] ) output = output . decode ( 'utf8' ) . strip ( ) disallowed_libraries = [ ] linked_libraries = output . split ( '\n' ) [ 1 : ] for linked_library in linked_libraries : linked_library = linked_library . lstrip ( '\t' ) open_paren = linked_library . rindex ( '(' ) linked_library = linked_library [ : open_paren - 1 ] if linked_library not in allowed_libraries : disallowed_libraries . append ( linked_library ) if not disallowed_libraries : return True print ( '{} linked against the following disallowed libraries:' . format ( image_path ) , file = sys . stderr ) for disallowed_library in disallowed_libraries : print ( '    {}' . format ( disallowed_library ) , file = sys . stderr ) return False
Verifies that the Mach-O image residing at |image_path| is only linked
against dynamic libraries listed in |allowed_libraries|.
Verifies that the Mach - O image residing at |image_path| is only linked against dynamic libraries listed in |allowed_libraries| .
"""Verifies that the Mach-O image residing at |image_path| is only linked
    against dynamic libraries listed in |allowed_libraries|. The image does
    not have to link against everything that is allowed, but it cannot link
    against anything that is not allowed. Returns True if the image only
    links against allowed libraries, and otherwise returns False with an error
    printed.
    """ # Skip the first line of output, which is image_path. # The line starts with a tab, followed by the image path, followed by # a space and then version information in parentheses.
image_path
allowed_libraries
binary_path