Skip to content

Commit

Permalink
feat(tools): Combine archiving changelog and calling age-cli
Browse files Browse the repository at this point in the history
  • Loading branch information
attakei committed May 15, 2024
1 parent 93bf728 commit 5b0089a
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 20 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ setup = {chain = ["setup:sync", "setup:pre-commit", "setup:playwright"]}
"setup:pre-commit" = "pre-commit install"
"setup:playwright" = "rye run playwright install firefox"
doc = "make -C doc"
age = "python tools/run_age.py"

[tool.pytest.ini_options]
addopts = "--browser firefox"
Expand Down
20 changes: 0 additions & 20 deletions tools/archive_changelog.py

This file was deleted.

31 changes: 31 additions & 0 deletions tools/run_age.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env python
"""Wapper to ``age`` CLI.
age cannot copy and move files in updating process.
"""

import argparse
import shutil
from pathlib import Path
from subprocess import run

from atsphinx.mini18n import __version__ as version

project_root = Path(__file__).parent.parent
archive_to = project_root / "doc" / "changelogs"

parser = argparse.ArgumentParser()
parser.add_argument("age_args", nargs="+") # All arguments are passed to age-cli.


def main(args: argparse.Namespace): # noqa: D103
# Move changelog into document to use as old logs.
changes_rst = project_root / "CHANGES.rst"
shutil.move(changes_rst, archive_to / f"{version}.rst")
changes_rst.write_text("TEMPLATE")
# Run age.
run(["age"] + args.age_args)


if __name__ == "__main__":
main(parser.parse_args())

0 comments on commit 5b0089a

Please sign in to comment.