Skip to content

Commit 028abfe

Browse files
DaanDeMeyerjpakkane
authored andcommitted
minstall: Don't treat symlinks to directories as directories in do_copydir()
As documented in https://docs.python.org/3/library/os.html#os.walk: > dirnames is a list of the names of the subdirectories in dirpath > (including symlinks to directories, and excluding '.' and '..') So currently, we treat any symlink to a directory as a directory instead of as a symlink. In practice, this means symlinks to directories are installed as empty directories instead of as symlinks. Let's make sure the symlinks are kept intact by checking for symlinks when we iterate over the directory names and treating any symlinks we find as files instead of as symlinks.
1 parent bb776a5 commit 028abfe

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

mesonbuild/minstall.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,9 @@ def do_copydir(self, data: InstallData, src_dir: str, dst_dir: str,
507507
abs_src = os.path.join(root, d)
508508
filepart = os.path.relpath(abs_src, start=src_dir)
509509
abs_dst = os.path.join(dst_dir, filepart)
510+
if os.path.islink(abs_src):
511+
files.append(d)
512+
continue
510513
# Remove these so they aren't visited by os.walk at all.
511514
if filepart in exclude_dirs:
512515
dirs.remove(d)

0 commit comments

Comments
 (0)