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 <keithshort@google.com>
This commit is contained in:
Keith Short 2023-03-24 15:22:42 -06:00 committed by Carles Cufí
parent 52e6b4e1fe
commit df0942f343

View File

@ -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