summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/python/package.py
diff options
context:
space:
mode:
Diffstat (limited to 'var/spack/repos/builtin/packages/python/package.py')
-rw-r--r--var/spack/repos/builtin/packages/python/package.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/var/spack/repos/builtin/packages/python/package.py b/var/spack/repos/builtin/packages/python/package.py
index 6087ff5be8..15901872e9 100644
--- a/var/spack/repos/builtin/packages/python/package.py
+++ b/var/spack/repos/builtin/packages/python/package.py
@@ -870,7 +870,18 @@ class Python(AutotoolsPackage):
backup=False
)
else:
- orig_link_target = os.path.realpath(src)
+ # orig_link_target = os.path.realpath(src) is insufficient when
+ # the spack install tree is located at a symlink or a
+ # descendent of a symlink. What we need here is the real
+ # relative path from the python prefix to src
+ # TODO: generalize this logic in the link_tree object
+ # add a method to resolve a link relative to the link_tree
+ # object root.
+ realpath_src = os.path.realpath(src)
+ realpath_prefix = os.path.realpath(self.spec.prefix)
+ realpath_rel = os.path.relpath(realpath_src, realpath_prefix)
+ orig_link_target = os.path.join(self.spec.prefix, realpath_rel)
+
new_link_target = os.path.abspath(merge_map[orig_link_target])
view.link(new_link_target, dst)