mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2026-07-31 16:47:59 -05:00
test: change permissions of testfiles only $SPHINX_READONLY_TESTDIR set
This commit is contained in:
+10
-9
@@ -109,15 +109,16 @@ 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 & ~UMASK)
|
||||
for name in files:
|
||||
os.chmod(os.path.join(root, name), 0o644 & ~UMASK)
|
||||
if os.environ.get('SPHINX_READONLY_TESTDIR'):
|
||||
# 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 & ~UMASK)
|
||||
for name in files:
|
||||
os.chmod(os.path.join(root, name), 0o644 & ~UMASK)
|
||||
|
||||
def movetree(self, destination: str) -> None:
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user