diff options
author | Daniel Friesel <daniel.friesel@uos.de> | 2022-06-21 15:34:33 +0200 |
---|---|---|
committer | Daniel Friesel <daniel.friesel@uos.de> | 2022-06-21 15:34:33 +0200 |
commit | f66449ac4f9c88ad3da834d041a25e1da6eb8d8c (patch) | |
tree | b7cc7fb1be9e7c200ca6f0a60c98c12b27044252 /bin | |
parent | c9097d5f6346271e3f3c5198cda0901d5a979776 (diff) |
analyze-kconfig: add ubjson support
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/analyze-kconfig.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/bin/analyze-kconfig.py b/bin/analyze-kconfig.py index 2223a4d..4b84921 100755 --- a/bin/analyze-kconfig.py +++ b/bin/analyze-kconfig.py @@ -169,10 +169,20 @@ def main(): else: # show-failing-symbols, show-nop-symbols, DFATOOL_KCONF_WITH_CHOICE_NODES, DFATOOL_KCONF_IGNORE_NUMERIC, and DFATOOL_KCONF_IGNORE_STRING have no effect # in this branch. - import lzma - with lzma.open(args.model, "rt") as f: - observations = json.load(f) + if args.model.endswith("xz"): + import lzma + + with lzma.open(args.model, "rt") as f: + observations = json.load(f) + elif args.model.endswith("ubjson"): + import ubjson + + with open(args.model, "rb") as f: + observations = ubjson.load(f) + else: + with open(args.model, "r") as f: + observations = json.load(f) if bool(int(os.getenv("DFATOOL_KCONF_IGNORE_STRING", 0))): attributes = KConfigAttributes(args.kconfig_path, None) |