Skip to content

Commit 75bde4d

Browse files
GrufoonyCopilot
andauthored
Update setup.py
Co-authored-by: Copilot <[email protected]>
1 parent 6f83c8f commit 75bde4d

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

setup.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -143,18 +143,12 @@ def build_extension(self, ext: CMakeExtension):
143143
if tbb_libs:
144144
print(f"Found TBB libraries: {tbb_libs}")
145145
for lib in tbb_libs:
146-
# We only want the real shared object, not symlinks if possible,
147-
# but copying everything matching the pattern is safer to ensure we get the versioned one.
148-
# However, we need to be careful not to overwrite if multiple matches found.
149-
# Usually we want the one that the linker linked against.
150-
# Since we set RPATH to $ORIGIN (Linux) or @loader_path (macOS), we need the library in the same dir as the extension.
151-
152-
# Avoid copying if it's a symlink pointing to something we already copied?
153-
# simpler: just copy all of them.
154-
dest = extdir / lib.name
146+
# Only copy real files, not symlinks. If it's a symlink, copy its target.
147+
target_lib = lib.resolve() if lib.is_symlink() else lib
148+
dest = extdir / target_lib.name
155149
if not dest.exists():
156-
shutil.copy2(lib, dest)
157-
print(f"Copied {lib} to {dest}")
150+
shutil.copy2(target_lib, dest, follow_symlinks=True)
151+
print(f"Copied {target_lib} to {dest}")
158152
else:
159153
print("Warning: No TBB shared libraries found to copy.")
160154

0 commit comments

Comments
 (0)