aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Tismer <tismer@stackless.com>2015-06-27 01:30:45 +0200
committerChristian Tismer <tismer@stackless.com>2015-06-27 01:30:45 +0200
commitd3e720d8f23b435026f29ade1f6fce320cc6af04 (patch)
treef5cd7b5b474dc50fffc2120f929ff8e324ad84dc
parentfab3a2f4ea6013f84d58bddbb936d9797e2fa8f9 (diff)
fix an old installer error with rpath.
This bug is old, but showed up after I tried to build parts of PySide for Qt5. Problem: There are rpath entries which don't trigger creation of an rpath command. This can be seen when Qt is not linked, and qtcore has an explicit path.
-rw-r--r--setup.py8
-rw-r--r--utils.py16
2 files changed, 15 insertions, 9 deletions
diff --git a/setup.py b/setup.py
index 27ea30eeb..b2798e243 100644
--- a/setup.py
+++ b/setup.py
@@ -932,10 +932,10 @@ class pyside_build(_build):
raise RuntimeError("Error patching rpath in " + srcpath)
elif sys.platform == 'darwin':
- pyside_libs = [lib for lib in os.listdir(package_path) if filter_match(
+ 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)
+ def rpath_cmd(srcpath):
+ osx_localize_libpaths(srcpath, pyside_libs, None)
else:
raise RuntimeError('Not configured for platform ' +
@@ -951,7 +951,7 @@ class pyside_build(_build):
if not os.path.exists(srcpath):
continue
rpath_cmd(srcpath)
- print("Patched rpath to '$ORIGIN/' in %s." % (srcpath))
+ print("Patched rpath to '$ORIGIN/' (Linux) or updated rpath (OS/X) in %s." % (srcpath))
try:
diff --git a/utils.py b/utils.py
index a1634a139..b8a40dd01 100644
--- a/utils.py
+++ b/utils.py
@@ -578,11 +578,17 @@ def osx_localize_libpaths(libpath, local_libs, enc_path=None):
install_names = osx_get_install_names(libpath)
need_rpath = False
for install_name in install_names:
- if install_name[0] in '/@':
+ if install_name[0] == '/':
+ # absolute path, nothing to do
continue
- back_tick('install_name_tool -change %s @rpath/%s %s' %
- (install_name, install_name, libpath))
+ # we possibly need to add an rpath command.
+ # note that a @rpath may be there already, but no rpath command.
+ # this happens when Qt is not linked (with qt5 this is the default)
need_rpath = True
+ if install_name[0] != '@':
+ # we need to change a relative path to @rpath
+ back_tick('install_name_tool -change {ina} @rpath/{ina} {lipa}'.format(
+ ina=install_name, lipa=libpath ))
if need_rpath and enc_path not in osx_get_rpaths(libpath):
- back_tick('install_name_tool -add_rpath %s %s' %
- (enc_path, libpath))
+ back_tick('install_name_tool -add_rpath {epa} {lipa}'.format(
+ epa=enc_path, lipa=libpath ))