symlink relativization: determine target relative to the link directory (#13710)
when making a package relative, relocate links relative to link directory rather than the full link path (which includes the file name) because `os.path.relpath` expects a directory.
This commit is contained in:
parent
045e9c905f
commit
3f861e18b0
@ -502,11 +502,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,
|
||||
|
Loading…
Reference in New Issue
Block a user