From 9a598a6fcdea83d1d7bdc4c8cb97298dba5f44e0 Mon Sep 17 00:00:00 2001 From: Bruno Lopes Date: Sat, 3 Jan 2026 15:09:27 -0300 Subject: [PATCH] tools: Support for .framework on LC_LOAD_DYLIB section of lib_bundle.py It will not bundle the framework but now correctly point to @rpath. This will be specially useful since we do use Python.framework on macOS. --- tools/lib_bundle.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/lib_bundle.py b/tools/lib_bundle.py index 12995d36fa..22f4afdcd2 100644 --- a/tools/lib_bundle.py +++ b/tools/lib_bundle.py @@ -257,7 +257,10 @@ def set_rpath(binary, destbin=None): for old_dylib_path in regex: if old_dylib_path.startswith("/usr") or old_dylib_path.startswith("/System"): continue - new_dylib_path = os.path.join("@rpath", os.path.basename(old_dylib_path)) + if ".framework" in old_dylib_path: + new_dylib_path = os.path.join("@rpath", old_dylib_path[old_dylib_path.rfind("/", 0, old_dylib_path.find(".framework")) + 1:]) + else: + new_dylib_path = os.path.join("@rpath", os.path.basename(old_dylib_path)) if old_dylib_path != new_dylib_path: try: subprocess.run(['install_name_tool', '-change', old_dylib_path, new_dylib_path, binary], check=True, stderr=subprocess.DEVNULL)