mirror of
https://github.com/moparisthebest/xeps
synced 2024-11-24 18:22:24 -05:00
tools: allow archive.py to override archived XEPs
This commit is contained in:
parent
5afa32673d
commit
97f21995a2
@ -11,6 +11,17 @@ from datetime import datetime, timedelta
|
|||||||
from xeplib import load_xepinfos, Status
|
from xeplib import load_xepinfos, Status
|
||||||
|
|
||||||
|
|
||||||
|
def do_archive(xeps_dir, attic, xep, old_version, new_version):
|
||||||
|
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)])
|
||||||
|
|
||||||
|
shutil.copy(str(curr_file), str(attic_file))
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
import argparse
|
import argparse
|
||||||
|
|
||||||
@ -44,6 +55,14 @@ def main():
|
|||||||
help="Path to the attic (defaults to ../xep-attic/content/)"
|
help="Path to the attic (defaults to ../xep-attic/content/)"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
"xeps",
|
||||||
|
nargs="*",
|
||||||
|
type=int,
|
||||||
|
help="Additional XEPs (by their number) to archive. Useful for "
|
||||||
|
"purely editorial changes."
|
||||||
|
)
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
with args.old as f:
|
with args.old as f:
|
||||||
@ -58,6 +77,8 @@ def main():
|
|||||||
|
|
||||||
changed = False
|
changed = False
|
||||||
|
|
||||||
|
force_archive = set(args.xeps)
|
||||||
|
|
||||||
for xep, new_info in new_accepted.items():
|
for xep, new_info in new_accepted.items():
|
||||||
old_version = old_accepted.get(xep, {}).get("last_revision", {}).get(
|
old_version = old_accepted.get(xep, {}).get("last_revision", {}).get(
|
||||||
"version"
|
"version"
|
||||||
@ -67,14 +88,17 @@ def main():
|
|||||||
if old_version == new_version:
|
if old_version == new_version:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
curr_file = args.xeps_dir / "xep-{:04d}.html".format(xep)
|
force_archive.discard(xep)
|
||||||
attic_file = args.attic / "xep-{:04d}-{}.html".format(xep, new_version)
|
do_archive(args.xeps_dir, args.attic, xep, old_version, new_version)
|
||||||
|
changed = True
|
||||||
|
|
||||||
print("XEP-{:04d}:".format(xep), old_version, "->", new_version)
|
for xep in force_archive:
|
||||||
|
old_version = old_accepted.get(xep, {}).get("last_revision", {}).get(
|
||||||
|
"version"
|
||||||
|
)
|
||||||
|
new_version = new_accepted[xep]["last_revision"]["version"]
|
||||||
|
|
||||||
subprocess.check_call(["make", "build/xep-{:04d}.html".format(xep)])
|
do_archive(args.xeps_dir, args.attic, xep, old_version, new_version)
|
||||||
|
|
||||||
shutil.copy(str(curr_file), str(attic_file))
|
|
||||||
changed = True
|
changed = True
|
||||||
|
|
||||||
if changed:
|
if changed:
|
||||||
|
Loading…
Reference in New Issue
Block a user