diff --git a/fix-rpaths.py b/fix-rpaths.py index 8c8a407..1c8b8e9 100644 --- a/fix-rpaths.py +++ b/fix-rpaths.py @@ -55,13 +55,18 @@ for binary, dependencies in dependency_map.items(): for key in dependency_map: if key.endswith(dep_short_name): if binary == app_binary: - print(f'\t{dep} -> @rpath/{dep_short_name}') + new_path = f'@rpath/{dep_short_name}' + if new_path == dep: + continue + print(f'\t{dep} -> {new_path}') if not dry_run: - print('\t' + subprocess.check_output(['install_name_tool', '-change', dep, f'@rpath/{dep_short_name}', binary], text=True)) + print('\t' + subprocess.check_output(['install_name_tool', '-change', dep, new_path, binary], text=True)) else: new_path = f'@loader_path/{dep_short_name}' if is_framework: new_path = f'@loader_path/../../../{dep_short_name}' + if new_path == dep: + continue print(f'\t{dep} -> {new_path}') if not dry_run: print('\t' + subprocess.check_output(['install_name_tool', '-change', dep, new_path, binary], text=True))