Bug 1856347: Allow copy_contents to take an optional parameter ignore_dangling_symlinks r=gbrown

Differential Revision: https://phabricator.services.mozilla.com/D189855
This commit is contained in:
Tom Ritter 2023-10-05 19:45:24 +00:00
Родитель ae2fbf70fd
Коммит 77e925dc67
2 изменённых файлов: 10 добавлений и 3 удалений

Просмотреть файл

@ -470,7 +470,9 @@ class VendorManifest(MozbuildObject):
# GitLab puts everything down a directory; move it up.
if has_prefix:
tardir = mozpath.join(tmpextractdir.name, one_prefix)
mozfile.copy_contents(tardir, tmpextractdir.name)
mozfile.copy_contents(
tardir, tmpextractdir.name, ignore_dangling_symlinks=True
)
mozfile.remove(tardir)
if self.should_perform_step("include"):

Просмотреть файл

@ -305,7 +305,7 @@ def remove(path):
_call_with_windows_retry(shutil.rmtree, (path,))
def copy_contents(srcdir, dstdir):
def copy_contents(srcdir, dstdir, ignore_dangling_symlinks=False):
"""
Copy the contents of the srcdir into the dstdir, preserving
subdirectories.
@ -346,7 +346,12 @@ def copy_contents(srcdir, dstdir):
if errors:
raise Exception(errors)
else:
shutil.copytree(srcdir, dstdir, dirs_exist_ok=True)
shutil.copytree(
srcdir,
dstdir,
dirs_exist_ok=True,
ignore_dangling_symlinks=ignore_dangling_symlinks,
)
def move(src, dst):