From 32420374c5c3d46224d80abfa19c75e89835e9a3 Mon Sep 17 00:00:00 2001 From: Tom Schneider Date: Mon, 12 Apr 2021 19:35:36 +0200 Subject: [PATCH] Fix manifest generation script --- manage/update_manifest.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 manage/update_manifest.py diff --git a/manage/update_manifest.py b/manage/update_manifest.py new file mode 100644 index 0000000..64585ab --- /dev/null +++ b/manage/update_manifest.py @@ -0,0 +1,27 @@ +"""Update the manifest file.""" +import sys +import json +import os + + +def update_manifest(): + """Update the manifest file.""" + version = "0.0.0" + for index, value in enumerate(sys.argv): + if value in ["--version", "-V"]: + version = sys.argv[index + 1] + + with open( + f"{os.getcwd()}/custom_components/stadtreinigung_hamburg/manifest.json" + ) as manifestfile: + manifest = json.load(manifestfile) + + manifest["version"] = version + + with open( + f"{os.getcwd()}/custom_components/stadtreinigung_hamburg/manifest.json", "w" + ) as manifestfile: + manifestfile.write(json.dumps(manifest, indent=4, sort_keys=True)) + + +update_manifest() \ No newline at end of file