diff options
author | Greg Becker <becker33@llnl.gov> | 2019-10-24 16:27:21 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-24 16:27:21 -0500 |
commit | a6ea0bbbaea533bc024fcc326fece709fe5b24a6 (patch) | |
tree | 0d306647a6c5583bdb6ad85afd3a75332828897c | |
parent | 0f22e528f37525ed42e7eb9d4369879956677fef (diff) | |
download | spack-a6ea0bbbaea533bc024fcc326fece709fe5b24a6.tar.gz spack-a6ea0bbbaea533bc024fcc326fece709fe5b24a6.tar.bz2 spack-a6ea0bbbaea533bc024fcc326fece709fe5b24a6.tar.xz spack-a6ea0bbbaea533bc024fcc326fece709fe5b24a6.zip |
Views: fix python in views when python prefix is under a symlink (#12575)
* Fix python in views when python prefix is under a symlink
* Add todo for future generalization
-rw-r--r-- | var/spack/repos/builtin/packages/python/package.py | 13 |
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) |