Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/sphinx-doc/sphinx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Maitin-Shepard <jbms@google.com>2020-11-30 23:00:44 +0300
committerJeremy Maitin-Shepard <jbms@google.com>2020-12-13 00:28:47 +0300
commit8f93ba24d53bbbc018ce188fb3bcd8759b9c48e4 (patch)
treeac8232f1d3743e6118080b12b860013e6c56396f /sphinx/testing
parent9cf28264917800534e56a92c1fa5c1196c73e73f (diff)
Support testing from read-only filesystems
Diffstat (limited to 'sphinx/testing')
-rw-r--r--sphinx/testing/path.py9
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:
"""