diff options
-rw-r--r-- | build_scripts/main.py | 20 | ||||
-rw-r--r-- | build_scripts/platforms/unix.py | 1 |
2 files changed, 11 insertions, 10 deletions
diff --git a/build_scripts/main.py b/build_scripts/main.py index a7afa6c7b..7239d328e 100644 --- a/build_scripts/main.py +++ b/build_scripts/main.py @@ -1085,14 +1085,19 @@ class PysideBuild(_build, DistUtilsCommandMixin): raise RuntimeError("Error copying libclang library " f"from {clang_lib_path} to {destination_dir}. ") + def package_libraries(self, package_path): + """Returns the libraries of the Python module""" + UNIX_FILTERS = ["*.so", "*.so.*"] + DARWIN_FILTERS = ["*.so", "*.dylib"] + FILTERS = DARWIN_FILTERS if sys.platform == 'darwin' else UNIX_FILTERS + return [lib for lib in os.listdir( + package_path) if filter_match(lib, FILTERS)] + def update_rpath(self, package_path, executables, libexec=False): ROOT = '@loader_path' if sys.platform == 'darwin' else '$ORIGIN' QT_PATH = '/../lib' if libexec else '/Qt/lib' if sys.platform.startswith('linux'): - pyside_libs = [lib for lib in os.listdir( - package_path) if filter_match(lib, ["*.so", "*.so.*"])] - def rpath_cmd(srcpath): final_rpath = '' # Command line rpath option takes precedence over @@ -1110,9 +1115,6 @@ class PysideBuild(_build, DistUtilsCommandMixin): override=override) elif sys.platform == 'darwin': - pyside_libs = [lib for lib in os.listdir( - package_path) if filter_match(lib, ["*.so", "*.dylib"])] - def rpath_cmd(srcpath): final_rpath = '' # Command line rpath option takes precedence over @@ -1129,10 +1131,8 @@ class PysideBuild(_build, DistUtilsCommandMixin): else: raise RuntimeError(f"Not configured for platform {sys.platform}") - pyside_libs.extend(executables) - - # Update rpath in PySide6 libs - for srcname in pyside_libs: + # Update rpath + for srcname in executables: srcpath = os.path.join(package_path, srcname) if os.path.isdir(srcpath) or os.path.islink(srcpath): continue diff --git a/build_scripts/platforms/unix.py b/build_scripts/platforms/unix.py index 153e58af0..4b3ed0db0 100644 --- a/build_scripts/platforms/unix.py +++ b/build_scripts/platforms/unix.py @@ -253,5 +253,6 @@ def prepare_packages_posix(self, vars): if sys.platform.startswith('linux') or sys.platform.startswith('darwin'): rpath_path = "{st_build_dir}/{st_package_name}".format(**vars) self.update_rpath(rpath_path, executables) + self.update_rpath(rpath_path, self.package_libraries(rpath_path)) if libexec_executables: self.update_rpath(rpath_path, libexec_executables, libexec=True) |