aboutsummaryrefslogtreecommitdiffstats
path: root/build_scripts
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2021-07-01 14:17:49 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2021-07-06 06:45:37 +0000
commit401c8134dd84e3ad271c6a0a1e6248cf090d7fe4 (patch)
treece2a2ad39d9f4cbe077059325f85b3794c164945 /build_scripts
parent9daa6fd5497226733d74490c03990e8d5a88d8d2 (diff)
Pyside6/Qt Designer: Fix Python code preview not working on UNIX
Qt Designer as bundled by PySide6 was unable to find the uic binary in the libexec directory of the bundled Qt since that was only copied when QtWebEngine was built and the rcc/uic binaries were copied into the main directory. Also, libexec existed as a file containing qt.conf, which was created by a copy statement not checking for the target directory. Fix that by actually creating a libexec directory for uic, rcc and QtWebEngineProcess. Patch the executables accordingly. Add checks before copying qt.conf. Adapt pyside-tool to use libexec. The Windows code path remains the same, everything uses main directory there. Change-Id: I0c9f46fb776ed0315eecb6ed00202ea8d8f17fe2 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Tismer <tismer@stackless.com>
Diffstat (limited to 'build_scripts')
-rw-r--r--build_scripts/main.py9
-rw-r--r--build_scripts/platforms/linux.py16
-rw-r--r--build_scripts/platforms/macos.py11
-rw-r--r--build_scripts/platforms/unix.py23
4 files changed, 32 insertions, 27 deletions
diff --git a/build_scripts/main.py b/build_scripts/main.py
index 6f80d8dc4..a7afa6c7b 100644
--- a/build_scripts/main.py
+++ b/build_scripts/main.py
@@ -1085,7 +1085,10 @@ class PysideBuild(_build, DistUtilsCommandMixin):
raise RuntimeError("Error copying libclang library "
f"from {clang_lib_path} to {destination_dir}. ")
- def update_rpath(self, package_path, executables):
+ 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.*"])]
@@ -1101,7 +1104,7 @@ class PysideBuild(_build, DistUtilsCommandMixin):
# installed qt lib directory.
final_rpath = self.qtinfo.libs_dir
if OPTION["STANDALONE"]:
- final_rpath = "$ORIGIN/Qt/lib"
+ final_rpath = f'{ROOT}{QT_PATH}'
override = OPTION["STANDALONE"]
linux_fix_rpaths_for_library(self._patchelf_path, srcpath, final_rpath,
override=override)
@@ -1118,7 +1121,7 @@ class PysideBuild(_build, DistUtilsCommandMixin):
final_rpath = OPTION["RPATH_VALUES"]
else:
if OPTION["STANDALONE"]:
- final_rpath = "@loader_path/Qt/lib"
+ final_rpath = f'{ROOT}{QT_PATH}'
else:
final_rpath = self.qtinfo.libs_dir
macos_fix_rpaths_for_library(srcpath, final_rpath)
diff --git a/build_scripts/platforms/linux.py b/build_scripts/platforms/linux.py
index cbd47070d..092660072 100644
--- a/build_scripts/platforms/linux.py
+++ b/build_scripts/platforms/linux.py
@@ -37,6 +37,7 @@
##
#############################################################################
+import os
from ..utils import (copydir, copyfile, copy_icu_libs, find_files_using_glob,
linux_patch_executable)
from ..config import config
@@ -96,12 +97,6 @@ def prepare_standalone_package_linux(self, vars):
linux_patch_executable(self._patchelf_path, designer_path)
if self.is_webengine_built(built_modules):
- copydir("{qt_lib_execs_dir}",
- "{st_build_dir}/{st_package_name}/Qt/libexec",
- filter=None,
- recursive=False,
- vars=vars)
-
copydir("{qt_prefix_dir}/resources",
"{st_build_dir}/{st_package_name}/Qt/resources",
filter=None,
@@ -142,7 +137,8 @@ def prepare_standalone_package_linux(self, vars):
if copy_qt_conf:
# Copy the qt.conf file to libexec.
- copyfile(
- f"{{build_dir}}/{PYSIDE}/{{st_package_name}}/qt.conf",
- "{st_build_dir}/{st_package_name}/Qt/libexec",
- vars=vars)
+ qt_libexec_path = "{st_build_dir}/{st_package_name}/Qt/libexec".format(**vars)
+ if not os.path.isdir(qt_libexec_path):
+ os.makedirs(qt_libexec_path)
+ copyfile(f"{{build_dir}}/{PYSIDE}/{{st_package_name}}/qt.conf",
+ qt_libexec_path, vars=vars)
diff --git a/build_scripts/platforms/macos.py b/build_scripts/platforms/macos.py
index 81e826d73..dcbaff3a3 100644
--- a/build_scripts/platforms/macos.py
+++ b/build_scripts/platforms/macos.py
@@ -160,12 +160,6 @@ def prepare_standalone_package_macos(self, vars):
recursive=True, vars=vars, force_copy_symlinks=True)
if self.is_webengine_built(built_modules):
- copydir("{qt_lib_execs_dir}",
- "{st_build_dir}/{st_package_name}/Qt/libexec",
- filter=None,
- recursive=False,
- vars=vars)
-
copydir("{qt_prefix_dir}/resources",
"{st_build_dir}/{st_package_name}/Qt/resources",
filter=None,
@@ -181,10 +175,11 @@ def prepare_standalone_package_macos(self, vars):
if copy_qt_conf:
# Copy the qt.conf file to libexec.
+ if not os.path.isdir(qt_libexec_path):
+ os.makedirs(qt_libexec_path)
copyfile(
f"{{build_dir}}/{PYSIDE}/{{st_package_name}}/qt.conf",
- "{st_build_dir}/{st_package_name}/Qt/libexec",
- vars=vars)
+ qt_libexec_path, vars=vars)
if copy_plugins:
# <qt>/plugins/* -> <setup>/{st_package_name}/Qt/plugins
diff --git a/build_scripts/platforms/unix.py b/build_scripts/platforms/unix.py
index 47e02a719..153e58af0 100644
--- a/build_scripts/platforms/unix.py
+++ b/build_scripts/platforms/unix.py
@@ -78,6 +78,7 @@ def _copy_gui_executable(name, vars=None):
def prepare_packages_posix(self, vars):
executables = []
+ libexec_executables = []
# <install>/lib/site-packages/{st_package_name}/* ->
# <setup>/{st_package_name}
@@ -160,17 +161,25 @@ def prepare_packages_posix(self, vars):
filter=[f"{PYSIDE}-lupdate"],
recursive=False, vars=vars))
- if not OPTION['NO_QT_TOOLS']:
- executables.extend(copydir(
- "{install_dir}/bin/",
- "{st_build_dir}/{st_package_name}",
- filter=["uic", "rcc"],
- recursive=False, vars=vars))
+ lib_exec_filters = []
+ if not OPTION['NO_QT_TOOLS']:
+ lib_exec_filters.extend(['uic', 'rcc'])
# Copying assistant/designer
executables.extend(_copy_gui_executable('assistant', vars=vars))
executables.extend(_copy_gui_executable('designer', vars=vars))
+ # Copy libexec
+ built_modules = self.get_built_pyside_config(vars)['built_modules']
+ if self.is_webengine_built(built_modules):
+ lib_exec_filters.append('QtWebEngineProcess')
+ if lib_exec_filters:
+ libexec_executables.extend(copydir("{qt_lib_execs_dir}",
+ "{st_build_dir}/{st_package_name}/Qt/libexec",
+ filter=lib_exec_filters,
+ recursive=False,
+ vars=vars))
+
# <install>/lib/lib* -> {st_package_name}/
copydir(
"{install_dir}/lib/",
@@ -244,3 +253,5 @@ 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)
+ if libexec_executables:
+ self.update_rpath(rpath_path, libexec_executables, libexec=True)