From 7eb2c2e095d6ed2f9c55ebb1a543831cd2a2b1df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Sch=C3=A4fer?= Date: Sat, 13 Jun 2020 17:08:08 +0200 Subject: [PATCH] archive.py: add support for skipping building during archiving If it is known that the documents have already been built or if it is imperative to use the versions built even if local changes have been applied since the last build, this switch comes in handy. --- tools/archive.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tools/archive.py b/tools/archive.py index 497ec9be..6d534fb4 100755 --- a/tools/archive.py +++ b/tools/archive.py @@ -11,13 +11,14 @@ from datetime import datetime, timedelta from xeplib import load_xepinfos, Status -def do_archive(xeps_dir, attic, xep, old_version, new_version): +def do_archive(xeps_dir, attic, xep, old_version, new_version, build): curr_file = xeps_dir / "xep-{:04d}.html".format(xep) attic_file = attic / "xep-{:04d}-{}.html".format(xep, new_version) print("XEP-{:04d}:".format(xep), old_version, "->", new_version) - subprocess.check_call(["make", "build/xep-{:04d}.html".format(xep)]) + if build: + subprocess.check_call(["make", "build/xep-{:04d}.html".format(xep)]) shutil.copy(str(curr_file), str(attic_file)) @@ -55,6 +56,13 @@ def main(): help="Path to the attic (defaults to ../xep-attic/content/)" ) + parser.add_argument( + "--no-build", + action="store_false", + dest="build", + default=True, + ) + parser.add_argument( "xeps", nargs="*", @@ -89,7 +97,7 @@ def main(): continue force_archive.discard(xep) - do_archive(args.xeps_dir, args.attic, xep, old_version, new_version) + do_archive(args.xeps_dir, args.attic, xep, old_version, new_version, args.build) changed = True for xep in force_archive: @@ -98,7 +106,7 @@ def main(): ) new_version = new_accepted[xep]["last_revision"]["version"] - do_archive(args.xeps_dir, args.attic, xep, old_version, new_version) + do_archive(args.xeps_dir, args.attic, xep, old_version, new_version, args.build) changed = True if changed: