1
0
mirror of https://github.com/moparisthebest/xeps synced 2024-12-03 06:22:16 -05:00

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.
This commit is contained in:
Jonas Schäfer 2020-06-13 17:08:08 +02:00
parent a694dd21ab
commit 7eb2c2e095

View File

@ -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: