From 809672790e5fa6253fa765fa3a1e20b3c5b84def Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Sun, 19 Nov 2023 13:42:50 +0100 Subject: [PATCH] Fix usages of hist_lines_dir and manifests_dir --- tagging/update_wiki.py | 8 ++++---- tagging/write_manifest.py | 24 ++++++++++++------------ 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/tagging/update_wiki.py b/tagging/update_wiki.py index ad004e679f..8f80263c74 100755 --- a/tagging/update_wiki.py +++ b/tagging/update_wiki.py @@ -72,17 +72,17 @@ def remove_old_manifests(wiki_dir: Path) -> None: LOGGER.info(f"Removed manifest: {file.relative_to(wiki_dir)}") -def update_wiki(wiki_dir: Path, hist_line_dir: Path, manifest_dir: Path) -> None: +def update_wiki(wiki_dir: Path, hist_lines_dir: Path, manifests_dir: Path) -> None: LOGGER.info("Updating wiki") - for manifest_file in manifest_dir.glob("*.md"): + for manifest_file in manifests_dir.glob("*.md"): month = get_manifest_month(manifest_file) copy_to = wiki_dir / "manifests" / month / manifest_file.name copy_to.parent.mkdir(exist_ok=True) shutil.copy(manifest_file, copy_to) LOGGER.info(f"Added manifest file: {copy_to.relative_to(wiki_dir)}") - for build_history_line_file in sorted(hist_line_dir.glob("*.txt")): + for build_history_line_file in sorted(hist_lines_dir.glob("*.txt")): build_history_line = build_history_line_file.read_text() assert build_history_line.startswith("| `") month = build_history_line[3:10] @@ -116,4 +116,4 @@ def update_wiki(wiki_dir: Path, hist_line_dir: Path, manifest_dir: Path) -> None ) args = arg_parser.parse_args() - update_wiki(args.wiki_dir, args.hist_line_dir, args.manifest_dir) + update_wiki(args.wiki_dir, args.hist_lines_dir, args.manifests_dir) diff --git a/tagging/write_manifest.py b/tagging/write_manifest.py index eb7b66a8f3..4bfbf3f7e6 100755 --- a/tagging/write_manifest.py +++ b/tagging/write_manifest.py @@ -25,7 +25,7 @@ def write_build_history_line( short_image_name: str, registry: str, owner: str, - hist_line_dir: Path, + hist_lines_dir: Path, filename: str, all_tags: list[str], ) -> None: @@ -44,15 +44,15 @@ def write_build_history_line( ] ) build_history_line = f"| {date_column} | {image_column} | {links_column} |" - hist_line_dir.mkdir(parents=True, exist_ok=True) - (hist_line_dir / f"{filename}.txt").write_text(build_history_line) + hist_lines_dir.mkdir(parents=True, exist_ok=True) + (hist_lines_dir / f"{filename}.txt").write_text(build_history_line) def write_manifest_file( short_image_name: str, registry: str, owner: str, - manifest_dir: Path, + manifests_dir: Path, filename: str, manifests: list[ManifestInterface], container: Container, @@ -65,16 +65,16 @@ def write_manifest_file( ] + [manifest.markdown_piece(container) for manifest in manifests] markdown_content = "\n\n".join(markdown_pieces) + "\n" - manifest_dir.mkdir(parents=True, exist_ok=True) - (manifest_dir / f"{filename}.md").write_text(markdown_content) + manifests_dir.mkdir(parents=True, exist_ok=True) + (manifests_dir / f"{filename}.md").write_text(markdown_content) def write_manifest( short_image_name: str, registry: str, owner: str, - hist_line_dir: Path, - manifest_dir: Path, + hist_lines_dir: Path, + manifests_dir: Path, ) -> None: LOGGER.info(f"Creating manifests for image: {short_image_name}") taggers, manifests = get_taggers_and_manifests(short_image_name) @@ -91,13 +91,13 @@ def write_manifest( tags_prefix + "-" + tagger.tag_value(container) for tagger in taggers ] write_build_history_line( - short_image_name, registry, owner, hist_line_dir, filename, all_tags + short_image_name, registry, owner, hist_lines_dir, filename, all_tags ) write_manifest_file( short_image_name, registry, owner, - manifest_dir, + manifests_dir, filename, manifests, container, @@ -145,6 +145,6 @@ def write_manifest( args.short_image_name, args.registry, args.owner, - args.hist_line_dir, - args.manifest_dir, + args.hist_lines_dir, + args.manifests_dir, )