diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-08-24 12:41:08 +0200 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2018-08-24 11:55:32 +0000 |
commit | 9385e1731153eebb25885f2bf51bb9cd91d6f7a4 (patch) | |
tree | f24b2a14e64ad5ddeba1ce0f49e80f290c163d9c | |
parent | b5a574eaeeb6a4f30794e6012b96f05a3de49217 (diff) |
shiboken: Fix naming of shipped libclang
Determine the library name by resolving just one symlink
so that the name containing only the major version is used
as target name (libclang.so.6 instead of libclang.so.6.0
obtained by completelely resolving the symlinks).
Task-number: PYSIDE-756
Change-Id: If70f292b2f1d0002d2d944fb019838ea4a623882
Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Reviewed-by: Christian Tismer <tismer@stackless.com>
-rw-r--r-- | build_scripts/main.py | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/build_scripts/main.py b/build_scripts/main.py index d825357fd..b64d6f1a9 100644 --- a/build_scripts/main.py +++ b/build_scripts/main.py @@ -1207,6 +1207,7 @@ class PysideBuild(_build): raise RuntimeError("Could not find the location of the libclang " "library inside the CMake cache file.") + target_name = None if is_win: # clang_lib_path points to the static import library # (lib/libclang.lib), whereas we want to copy the shared @@ -1214,10 +1215,21 @@ class PysideBuild(_build): clang_lib_path = re.sub(r'lib/libclang.lib$', 'bin/libclang.dll', clang_lib_path) else: + if sys.platform != 'darwin' and os.path.islink(clang_lib_path): + # On Linux, we get "libclang.so" from CMake which is + # a symlink: + # libclang.so -> libclang.so.6 -> libclang.so.6.0. + # shiboken2 links against libclang.so.6. So, we + # determine the target name by resolving just + # one symlink (note: os.path.realpath() resolves all). + target_name = os.readlink(clang_lib_path) # We want to resolve any symlink on Linux and macOS, and # copy the actual file. clang_lib_path = os.path.realpath(clang_lib_path) + if not target_name: + target_name = os.path.basename(clang_lib_path) + # Path to directory containing libclang. clang_lib_dir = os.path.dirname(clang_lib_path) @@ -1226,9 +1238,10 @@ class PysideBuild(_build): destination_dir = "{}/PySide2".format(os.path.join(self.script_dir, 'pyside_package')) if os.path.exists(clang_lib_path): - log.info('Copying libclang shared library to the package folder.') + log.info('Copying libclang shared library {} to the package folder as {}.'.format( + clang_lib_path, target_name)) basename = os.path.basename(clang_lib_path) - destination_path = os.path.join(destination_dir, basename) + destination_path = os.path.join(destination_dir, target_name) # Need to modify permissions in case file is not writable # (a reinstall would cause a permission denied error). |