aboutsummaryrefslogtreecommitdiffstats
path: root/setup.py
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2017-10-23 16:43:49 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2017-11-15 15:46:58 +0000
commit554a82039fb5165bf2e1922551df54dd9fbf3d2c (patch)
tree0a4bf50e99e83a4c611870ad09bfe25cba4084c9 /setup.py
parent7d58c8b4f6c6692ca0c856f676c05f3a84d40c43 (diff)
Fix rpath handling on macOS
This change ultimately allows running python scripts that use PySide2 without setting DYLD_LIBRARY_PATH / DYLD_FRAMEWORK_PATH. It is achieved by embedding a @loader_path LC_RPATH into all PySide shared libraries, so that they can load each other if they have dependencies. Also an additional LC_RPATH is embedded to point to the Qt libraries directory which was used for building PySide2. A new option "--rpath='your_value'" is available to allow manually specifying the rpath value to be embedded into the libraries. Change-Id: Id783196e908877692312b1d40fef4ad0b09f3e68 Task-number: PYSIDE-558 Reviewed-by: Christian Tismer <tismer@stackless.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/setup.py b/setup.py
index a79769522..0335a7a2b 100644
--- a/setup.py
+++ b/setup.py
@@ -49,6 +49,10 @@ to build and install into your current Python installation.
On Linux you can use option --standalone, to embed Qt libraries to PySide2 distribution
+You can use option --rpath="your_value" to specify what rpath values should be embedded into the
+PySide2 modules and shared libraries. This overrides the automatically generated values when the
+option is not specified.
+
You can use option --only-package, if you want to create more binary packages (bdist_wheel, bdist_egg, ...)
without rebuilding entire PySide2 every time:
# First time we create bdist_wheel with full PySide2 build
@@ -176,7 +180,7 @@ from utils import update_env_path
from utils import init_msvc_env
from utils import regenerate_qt_resources
from utils import filter_match
-from utils import osx_localize_libpaths
+from utils import osx_fix_rpaths_for_library
# guess a close folder name for extensions
def get_extension_folder(ext):
@@ -233,6 +237,7 @@ OPTION_REUSE_BUILD = has_option("reuse-build")
OPTION_SKIP_CMAKE = has_option("skip-cmake")
OPTION_SKIP_MAKE_INSTALL = has_option("skip-make-install")
OPTION_SKIP_PACKAGING = has_option("skip-packaging")
+OPTION_RPATH_VALUES = option_value("rpath")
if OPTION_QT_VERSION is None:
OPTION_QT_VERSION = "5"
@@ -1226,7 +1231,13 @@ class pyside_build(_build):
pyside_libs = [lib for lib in os.listdir(package_path) if filter_match(
lib, ["*.so", "*.dylib"])]
def rpath_cmd(srcpath):
- osx_localize_libpaths(srcpath, pyside_libs, None)
+ final_rpath = ''
+ # Command line rpath option takes precedence over automatically added one.
+ if OPTION_RPATH_VALUES:
+ final_rpath = OPTION_RPATH_VALUES
+ else:
+ final_rpath = self.qtinfo.libs_dir
+ osx_fix_rpaths_for_library(srcpath, final_rpath)
else:
raise RuntimeError('Not configured for platform ' +