summaryrefslogtreecommitdiff
path: root/bin/observations-enum-to-kconfig.py
diff options
context:
space:
mode:
authorDaniel Friesel <daniel.friesel@uos.de>2022-11-01 10:59:08 +0100
committerDaniel Friesel <daniel.friesel@uos.de>2022-11-01 10:59:08 +0100
commit4c2234e71d85583ca6c7d83cc4856e15778db732 (patch)
treed42ae4f9898ad0fd434d2a14b7ece527ec4ff1c7 /bin/observations-enum-to-kconfig.py
parentd5d7b960882662d218664ed669fc4dfd034fde33 (diff)
add enum-to-kconfig exporter (using n/y rather than 0/1)
Diffstat (limited to 'bin/observations-enum-to-kconfig.py')
-rwxr-xr-xbin/observations-enum-to-kconfig.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/bin/observations-enum-to-kconfig.py b/bin/observations-enum-to-kconfig.py
new file mode 100755
index 0000000..7462382
--- /dev/null
+++ b/bin/observations-enum-to-kconfig.py
@@ -0,0 +1,23 @@
+#!/usr/bin/env python3
+
+import dfatool.utils
+import json
+import lzma
+import sys
+
+
+def main():
+ infile = sys.argv[1]
+ outfile = sys.argv[2]
+
+ with lzma.open(infile, "rt") as f:
+ observations = json.load(f)
+
+ dfatool.utils.observations_enum_to_bool(observations, kconfig=True)
+
+ with lzma.open(outfile, "wt") as f:
+ json.dump(observations, f)
+
+
+if __name__ == "__main__":
+ main()