Skip to content

Instantly share code, notes, and snippets.

@tseaver
Created January 6, 2015 13:56
Show Gist options
  • Save tseaver/25a26a350b3b129ca4d9 to your computer and use it in GitHub Desktop.
Save tseaver/25a26a350b3b129ca4d9 to your computer and use it in GitHub Desktop.
diff --git a/zc.recipe.egg_/src/zc/recipe/egg/custom.py b/zc.recipe.egg_/src/zc/recipe/egg/custom.py
index ba7f5c4..7258827 100644
--- a/zc.recipe.egg_/src/zc/recipe/egg/custom.py
+++ b/zc.recipe.egg_/src/zc/recipe/egg/custom.py
@@ -130,7 +130,7 @@ class Develop(Base):
def build_ext(buildout, options):
result = {}
- for be_option in ('include-dirs', 'library-dirs', 'rpath'):
+ for be_option in ('include-dirs', 'library-dirs'):
value = options.get(be_option)
if value is None:
continue
@@ -145,6 +145,23 @@ def build_ext(buildout, options):
result[be_option] = os.pathsep.join(value)
options[be_option] = os.pathsep.join(value)
+ # rpath has special symbolic dirnames which must not be prefixed
+ # with the buildout dir. See:
+ # http://man7.org/linux/man-pages/man8/ld.so.8.html
+ RPATH_SPECIAL = [
+ '$ORIGIN', '$LIB', '$PLATFORM', '${ORIGIN}', '${LIB}', '${PLATFORM}']
+ def _prefix_non_special(x):
+ x = x.strip()
+ for special in RPATH_SPECIAL:
+ if x.startswith(special):
+ return x
+ return os.path.join( buildout['buildout']['directory'], x)
+
+ value = options.get('rpath')
+ if value is not None:
+ values = [_prefix_non_special(v)
+ for v in value.strip().split('\n') if v.strip()]
+
swig = options.get('swig')
if swig:
options['swig'] = result['swig'] = os.path.join(
@woutervh
Copy link

woutervh commented Jan 7, 2015

I think there is something missing.
at line 34, the values are correct, but they are not used anywhere?

If the values are added to the result and options-variables,
then this is patch fixes the problem:

+ ...
+ value = options.get('rpath')
+ if value is not None:
+     values = [_prefix_non_special(v)
+                    for v in value.strip().split('\n') if v.strip()] 
+ result['rpath'] = os.pathsep.join(values)
+ options['rpath'] = os.pathsep.join(values)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment