From fc2bc42eecfb03c6bf8d35b4ef2d3af6a5f13fcb Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Tue, 4 Jan 2022 23:06:50 +0000 Subject: scripts: Update to use exec_module() instead of load_module() This is deprecated in python 3.12 and Fedora 35 is throwing warnings so move to the new functions. (From OE-Core rev: 655cd3f614d736416eab0d708b7c49674bf5c977) Signed-off-by: Richard Purdie --- scripts/lib/scriptutils.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'scripts/lib/scriptutils.py') diff --git a/scripts/lib/scriptutils.py b/scripts/lib/scriptutils.py index 3164171eb2..47a08194d0 100644 --- a/scripts/lib/scriptutils.py +++ b/scripts/lib/scriptutils.py @@ -18,7 +18,8 @@ import sys import tempfile import threading import importlib -from importlib import machinery +import importlib.machinery +import importlib.util class KeepAliveStreamHandler(logging.StreamHandler): def __init__(self, keepalive=True, **kwargs): @@ -82,7 +83,9 @@ def load_plugins(logger, plugins, pluginpath): logger.debug('Loading plugin %s' % name) spec = importlib.machinery.PathFinder.find_spec(name, path=[pluginpath] ) if spec: - return spec.loader.load_module() + mod = importlib.util.module_from_spec(spec) + spec.loader.exec_module(mod) + return mod def plugin_name(filename): return os.path.splitext(os.path.basename(filename))[0] -- cgit v1.2.3-54-g00ecf