How to use the delocate.tools.get_install_names function in delocate

To help you get started, we’ve selected a few delocate examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github MacPython / terryfy / repath_lib_names.py View on Github external
def repath_lib(lib_fname, old_path, new_path):
    install_id = get_install_id(lib_fname)
    L = len(old_path)
    if install_id and install_id.startswith(old_path):
        set_install_id(lib_fname, new_path + install_id[L:])
    for name in get_install_names(lib_fname):
        if name.startswith(old_path):
            set_install_name(lib_fname, name, new_path + name[L:])
github matthew-brett / delocate / delocate / libsana.py View on Github external
See:

    * https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/dyld.1.html  # noqa: E501
    * http://matthew-brett.github.io/pydagogue/mac_runtime_link.html
    """
    lib_dict = {}
    env_var_paths = get_environment_variable_paths()
    for dirpath, dirnames, basenames in os.walk(start_path):
        for base in basenames:
            depending_libpath = realpath(pjoin(dirpath, base))
            if filt_func is not None and not filt_func(depending_libpath):
                continue
            rpaths = get_rpaths(depending_libpath)
            search_paths = rpaths + env_var_paths
            for install_name in get_install_names(depending_libpath):
                # If the library starts with '@rpath' we'll try and resolve it
                # We'll do nothing to other '@'-paths
                # Otherwise we'll search for the library using env variables
                if install_name.startswith('@rpath'):
                    lib_path = resolve_rpath(install_name, search_paths)
                elif install_name.startswith('@'):
                    lib_path = install_name
                else:
                    lib_path = search_environment_for_lib(install_name)
                if lib_path in lib_dict:
                    lib_dict[lib_path][depending_libpath] = install_name
                else:
                    lib_dict[lib_path] = {depending_libpath: install_name}
    return lib_dict