Skip to content

Commit

Permalink
Fix directories for suggested use pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
AA-Turner committed Sep 25, 2024
1 parent 8c93ad1 commit 50e99b5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions check_times.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
.. code-block:: bash
$ scp "[email protected]:/var/log/docsbuild/docsbuild.log*" docsbuild-logs
$ mkdir -p docsbuild-logs
$ scp "[email protected]:/var/log/docsbuild/docsbuild.log*" docsbuild-logs/
$ python check_times.py
"""

Expand All @@ -15,15 +16,17 @@

from build_docs import format_seconds

LOGS_ROOT = Path('docsbuild-logs').resolve()


def get_lines() -> list[str]:
lines = []
zipped_logs = list(Path.cwd().glob("docsbuild.log.*.gz"))
zipped_logs = list(LOGS_ROOT.glob("docsbuild.log.*.gz"))
zipped_logs.sort(key=lambda p: int(p.name.split(".")[-2]), reverse=True)
for logfile in zipped_logs:
with gzip.open(logfile, "rt", encoding="utf-8") as f:
lines += f.readlines()
with open("docsbuild.log", encoding="utf-8") as f:
with open(LOGS_ROOT / "docsbuild.log", encoding="utf-8") as f:
lines += f.readlines()
return lines

Expand Down

0 comments on commit 50e99b5

Please sign in to comment.