From df0942f34397adeeaa59fc4835cc7deb78d18238 Mon Sep 17 00:00:00 2001 From: Keith Short Date: Fri, 24 Mar 2023 15:22:42 -0600 Subject: [PATCH] scripts: kconfigfunctions: cleanup edt loading An explicit import of edtlib is not required when using pickle.load() and creates a duplicate module object. Retrieve the correct module object directly from the pickle file using inspect.getmodule(). Signed-off-by: Keith Short --- scripts/kconfig/kconfigfunctions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/kconfig/kconfigfunctions.py b/scripts/kconfig/kconfigfunctions.py index ebec7f583c0..fc76d683e0d 100644 --- a/scripts/kconfig/kconfigfunctions.py +++ b/scripts/kconfig/kconfigfunctions.py @@ -3,6 +3,7 @@ # # SPDX-License-Identifier: Apache-2.0 +import inspect import os import pickle import sys @@ -12,8 +13,6 @@ ZEPHYR_BASE = str(Path(__file__).resolve().parents[2]) sys.path.insert(0, os.path.join(ZEPHYR_BASE, "scripts", "dts", "python-devicetree", "src")) -from devicetree import edtlib - # Types we support # 'string', 'int', 'hex', 'bool' @@ -26,6 +25,7 @@ if not doc_mode: if EDT_PICKLE is not None and os.path.isfile(EDT_PICKLE): with open(EDT_PICKLE, 'rb') as f: edt = pickle.load(f) + edtlib = inspect.getmodule(edt) else: edt = None