From f66449ac4f9c88ad3da834d041a25e1da6eb8d8c Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Tue, 21 Jun 2022 15:34:33 +0200 Subject: analyze-kconfig: add ubjson support --- bin/analyze-kconfig.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'bin') 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) -- cgit v1.2.3