summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPeter Scheibel <scheibel1@llnl.gov>2019-11-14 12:15:47 -0800
committerGreg Becker <becker33@llnl.gov>2019-11-14 12:15:47 -0800
commit28163cb34fda3a42c14fbe7ce036291748bcc576 (patch)
tree74ae82594d3ba1476b0c2060ad7fea05c734b562 /lib
parentb280034380f82c1badbe320fe6763ef04620c8fe (diff)
downloadspack-28163cb34fda3a42c14fbe7ce036291748bcc576.tar.gz
spack-28163cb34fda3a42c14fbe7ce036291748bcc576.tar.bz2
spack-28163cb34fda3a42c14fbe7ce036291748bcc576.tar.xz
spack-28163cb34fda3a42c14fbe7ce036291748bcc576.zip
determine target relative to the link directory rather than the full link path (which includes the file name) (#13727)
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/relocate.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/spack/spack/relocate.py b/lib/spack/spack/relocate.py
index 472195866e..744338d7e5 100644
--- a/lib/spack/spack/relocate.py
+++ b/lib/spack/spack/relocate.py
@@ -488,11 +488,11 @@ def make_link_relative(cur_path_names, orig_path_names):
Change absolute links to be relative.
"""
for cur_path, orig_path in zip(cur_path_names, orig_path_names):
- old_src = os.readlink(orig_path)
- new_src = os.path.relpath(old_src, orig_path)
+ target = os.readlink(orig_path)
+ relative_target = os.path.relpath(target, os.path.dirname(orig_path))
os.unlink(cur_path)
- os.symlink(new_src, cur_path)
+ os.symlink(relative_target, cur_path)
def make_macho_binaries_relative(cur_path_names, orig_path_names, old_dir,