From a2bbcb707c01342403458fd6bcaac99e99411185 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 6 Jul 2021 13:25:56 +0200 Subject: build scripts: Fix broken packages (rpaths) The python modules were unable to find the Qt libraries after 401c8134dd84e3ad271c6a0a1e6248cf090d7fe4. This was since the update_rpath() appends the list of package libraries to the executables passed in and sets the rpath on them, too. This caused the libexec-rpath being set on them since the libexec executables were passed last. Disentangle this by splitting out a helper to find the package libraries and call update_rpath() separately for them. Amends 401c8134dd84e3ad271c6a0a1e6248cf090d7fe4. Change-Id: I8d647d4e9b1e24e1d6dbc87801bcb4e5fccaf88e Reviewed-by: Christian Tismer --- build_scripts/main.py | 20 ++++++++++---------- 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) -- cgit v1.2.3