Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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:])
if require_archs is not None:
stop_fast = not check_verbose
bads = check_archs(copied_libs, require_archs, stop_fast)
if len(bads) != 0:
if check_verbose:
print(bads_report(bads, pjoin(tmpdir, 'wheel')))
raise DelocationError(
"Some missing architectures in wheel")
# Change install ids to be unique within Python space
install_id_root = (DLC_PREFIX +
relpath(package_path, wheel_dir) +
'/')
for lib in copied_libs:
lib_base = basename(lib)
copied_path = pjoin(lib_path, lib_base)
set_install_id(copied_path, install_id_root + lib_base)
validate_signature(copied_path)
_merge_lib_dict(all_copied, copied_libs)
if len(all_copied):
rewrite_record(wheel_dir)
if len(all_copied) or not in_place:
dir2zip(wheel_dir, out_wheel)
return stripped_lib_dict(all_copied, wheel_dir + os.path.sep)