From aba51bb0cb597c14386a2286de57603048ef2e63 Mon Sep 17 00:00:00 2001 From: Dhinak G <17605561+dhinakg@users.noreply.github.com> Date: Tue, 3 Jan 2023 17:18:06 -0500 Subject: [PATCH] Bump schema version to 4 --- config_mgmt.py | 6 ++++-- update_config.py | 5 +++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/config_mgmt.py b/config_mgmt.py index 35234daa5d..ce17c50919 100644 --- a/config_mgmt.py +++ b/config_mgmt.py @@ -7,11 +7,13 @@ def save_config(data: dict): plugin_dir = config_dir / Path("plugins") plugin_dir.mkdir(exist_ok=True) + version = data["_version"] + for plugin in data: if plugin == "_version": continue data[plugin]["versions"].sort(key=lambda x: (x["date_committed"], x["date_authored"]), reverse=True) - json.dump(data[plugin] | {"_version": data["_version"]}, (plugin_dir / Path(f"{plugin}.json")).open("w"), sort_keys=True) + json.dump(data[plugin] | {"_version": version}, (plugin_dir / Path(f"{plugin}.json")).open("w"), sort_keys=True) latest = data.copy() for plugin in latest: @@ -21,4 +23,4 @@ def save_config(data: dict): json.dump(data, (config_dir / Path("config.json")).open("w"), sort_keys=True) json.dump(latest, (config_dir / Path("latest.json")).open("w"), sort_keys=True) - json.dump(list(data.keys()), (config_dir / Path("plugins.json")).open("w"), sort_keys=True) + json.dump({"plugins": list(data.keys()), "_version": version}, (config_dir / Path("plugins.json")).open("w"), sort_keys=True) diff --git a/update_config.py b/update_config.py index 41cf087eb8..cd72421774 100644 --- a/update_config.py +++ b/update_config.py @@ -64,6 +64,11 @@ def add_author_date(name, version): config["_version"] = 3 +# version 3 to 4 +# nothing changed, but the other json files were added + +if config["_version"] == 3: + config["_version"] = 4 save_config(config)