Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 15 additions & 18 deletions build_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
import re
import shlex
import shutil
import stat
import subprocess
import sys
import venv
Expand Down Expand Up @@ -744,18 +745,7 @@
group=self.group,
recursive=True,
)
run(["chmod", "-R", "o+r", self.checkout / "Doc" / "build" / "html"])
run([
"find",
self.checkout / "Doc" / "build" / "html",
"-type",
"d",
"-exec",
"chmod",
"o+x",
"{}",
";",
])
chmod_make_readable(self.checkout / "Doc" / "build" / "html")

Check warning on line 748 in build_docs.py

View check run for this annotation

Codecov / codecov/patch

build_docs.py#L748

Added line #L748 was not covered by tests
run([
"rsync",
"-a",
Expand All @@ -770,12 +760,7 @@
# Copy archive files to /archives/
logging.debug("Copying dist files.")
chgrp(self.checkout / "Doc" / "dist", group=self.group, recursive=True)
run([
"chmod",
"-R",
"o+r",
self.checkout / "Doc" / "dist",
])
chmod_make_readable(self.checkout / "Doc" / "dist")

Check warning on line 763 in build_docs.py

View check run for this annotation

Codecov / codecov/patch

build_docs.py#L763

Added line #L763 was not covered by tests
run(["mkdir", "-m", "o+rx", "-p", target / "archives"])
chgrp(target / "archives", group=self.group)
run([
Expand Down Expand Up @@ -907,6 +892,18 @@
logging.warning("Can't change group of %s: %s", path, str(err))


def chmod_make_readable(path: Path, /, mode: int = stat.S_IROTH) -> None:
if not path.is_dir():
raise ValueError

Check warning on line 897 in build_docs.py

View check run for this annotation

Codecov / codecov/patch

build_docs.py#L896-L897

Added lines #L896 - L897 were not covered by tests

path.chmod(path.stat().st_mode | stat.S_IROTH | stat.S_IXOTH) # o+rx
for p in path.rglob("*"):
if p.is_dir():
p.chmod(p.stat().st_mode | stat.S_IROTH | stat.S_IXOTH) # o+rx

Check warning on line 902 in build_docs.py

View check run for this annotation

Codecov / codecov/patch

build_docs.py#L899-L902

Added lines #L899 - L902 were not covered by tests
else:
p.chmod(p.stat().st_mode | stat.S_IROTH) # o+r

Check warning on line 904 in build_docs.py

View check run for this annotation

Codecov / codecov/patch

build_docs.py#L904

Added line #L904 was not covered by tests


def format_seconds(seconds: float) -> str:
hours, remainder = divmod(seconds, 3600)
minutes, seconds = divmod(remainder, 60)
Expand Down