diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-01-04 23:06:50 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2022-01-05 17:18:16 +0000 |
commit | fc2bc42eecfb03c6bf8d35b4ef2d3af6a5f13fcb (patch) | |
tree | a88585d48be35b5424e06f1a4e882f0b270e26d7 /scripts/lib/scriptutils.py | |
parent | 6209684ca67e8d683d096e07c6cf0543928fe138 (diff) | |
download | poky-fc2bc42eecfb03c6bf8d35b4ef2d3af6a5f13fcb.tar.gz |
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 <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/scriptutils.py')
-rw-r--r-- | scripts/lib/scriptutils.py | 7 |
1 files changed, 5 insertions, 2 deletions
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 | |||
18 | import tempfile | 18 | import tempfile |
19 | import threading | 19 | import threading |
20 | import importlib | 20 | import importlib |
21 | from importlib import machinery | 21 | import importlib.machinery |
22 | import importlib.util | ||
22 | 23 | ||
23 | class KeepAliveStreamHandler(logging.StreamHandler): | 24 | class KeepAliveStreamHandler(logging.StreamHandler): |
24 | def __init__(self, keepalive=True, **kwargs): | 25 | def __init__(self, keepalive=True, **kwargs): |
@@ -82,7 +83,9 @@ def load_plugins(logger, plugins, pluginpath): | |||
82 | logger.debug('Loading plugin %s' % name) | 83 | logger.debug('Loading plugin %s' % name) |
83 | spec = importlib.machinery.PathFinder.find_spec(name, path=[pluginpath] ) | 84 | spec = importlib.machinery.PathFinder.find_spec(name, path=[pluginpath] ) |
84 | if spec: | 85 | if spec: |
85 | return spec.loader.load_module() | 86 | mod = importlib.util.module_from_spec(spec) |
87 | spec.loader.exec_module(mod) | ||
88 | return mod | ||
86 | 89 | ||
87 | def plugin_name(filename): | 90 | def plugin_name(filename): |
88 | return os.path.splitext(os.path.basename(filename))[0] | 91 | return os.path.splitext(os.path.basename(filename))[0] |