Skip to content

Commit b63d31c

Browse files
Resolve the runtime path before patching it (#55)
1 parent 95e0f6a commit b63d31c

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

auditwheel_emscripten/module.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,11 @@ def patch_needed_path(self, dep_map: dict[str, Path]) -> bytes:
129129
def patch_runtime_path(self, runtime_path: Path) -> bytes:
130130
curfile = Path(self.filename).resolve()
131131

132-
relpath = os.path.relpath(runtime_path, curfile.parent)
132+
# On macOS, /tmp is a symlink to /private/tmp. See https://apple.stackexchange.com/a/1096
133+
# If we don't resolve it, the dylink.0 section for an extension module can have a broken
134+
# RUNTIME_PATH pointing to a temporary build directory (`/var/folders/<...>/package/package.libs`)
135+
# which causes the wheel to be non-relocatable.
136+
relpath = os.path.relpath(Path(runtime_path).resolve(), curfile.parent)
133137
if relpath == ".":
134138
realpath_with_prefix = "$ORIGIN"
135139
else:

0 commit comments

Comments
 (0)