diff options
-rw-r--r-- | sphinx/testing/path.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sphinx/testing/path.py b/sphinx/testing/path.py index a37839d60..1872f2577 100644 --- a/sphinx/testing/path.py +++ b/sphinx/testing/path.py @@ -98,6 +98,15 @@ class path(str): pointed to by the symbolic links are copied. """ shutil.copytree(self, destination, symlinks=symlinks) + # If source tree is marked read-only (e.g. because it is on a read-only + # filesystem), `shutil.copytree` will mark the destination as read-only + # as well. To avoid failures when adding additional files/directories + # to the destination tree, ensure destination directories are not marked + # read-only. + for root, dirs, files in os.walk(destination): + os.chmod(root, 0o755) + for name in files: + os.chmod(os.path.join(root, name), 0o644) def movetree(self, destination: str) -> None: """ |