Skip to content

Commit

Permalink
don't modify values of 'paths' list passed as argument to prepend_paths
Browse files Browse the repository at this point in the history
  • Loading branch information
boegel committed Jun 16, 2015
1 parent 4acd650 commit d3c3905
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions easybuild/tools/module_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,18 +226,21 @@ def prepend_paths(self, key, paths, allow_abs=False):
self.log.debug("Wrapping %s into a list before using it to prepend path %s" % (paths, key))
paths = [paths]

for i, path in enumerate(paths):
abspaths = []
for path in paths:
if os.path.isabs(path) and not allow_abs:
raise EasyBuildError("Absolute path %s passed to prepend_paths which only expects relative paths.",
path)
elif not os.path.isabs(path):
# prepend $root (= installdir) for (non-empty) relative paths
if path:
paths[i] = os.path.join('$root', path)
abspaths.append(os.path.join('$root', path))
else:
paths[i] = '$root'
abspaths.append('$root')
else:
abspaths.append(path)

statements = [template % (key, p) for p in paths]
statements = [template % (key, p) for p in abspaths]
return ''.join(statements)

def use(self, paths):
Expand Down

0 comments on commit d3c3905

Please sign in to comment.