Skip to content

Commit

Permalink
Avoid prefixing buildout dir to 'special' rpath elements.
Browse files Browse the repository at this point in the history
Fixes #225.
  • Loading branch information
tseaver committed Jan 7, 2015
1 parent f4dad6b commit fcd1dd4
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion zc.recipe.egg_/src/zc/recipe/egg/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def install(self):

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
Expand All @@ -145,6 +145,25 @@ 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()]
result['rpath'] = os.pathsep.join(value)
options['rpath'] = os.pathsep.join(value)

swig = options.get('swig')
if swig:
options['swig'] = result['swig'] = os.path.join(
Expand Down

1 comment on commit fcd1dd4

@woutervh
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why

        result['rpath'] = os.pathsep.join(value)
        options['rpath'] = os.pathsep.join(value)

and not?

        result['rpath'] = os.pathsep.join(values)
      options['rpath'] = os.pathsep.join(values)

Please sign in to comment.