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/wic/pluginbase.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/wic/pluginbase.py')
-rw-r--r-- | scripts/lib/wic/pluginbase.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/scripts/lib/wic/pluginbase.py b/scripts/lib/wic/pluginbase.py index d9b4e57747..b64568339b 100644 --- a/scripts/lib/wic/pluginbase.py +++ b/scripts/lib/wic/pluginbase.py | |||
@@ -9,9 +9,11 @@ __all__ = ['ImagerPlugin', 'SourcePlugin'] | |||
9 | 9 | ||
10 | import os | 10 | import os |
11 | import logging | 11 | import logging |
12 | import types | ||
12 | 13 | ||
13 | from collections import defaultdict | 14 | from collections import defaultdict |
14 | from importlib.machinery import SourceFileLoader | 15 | import importlib |
16 | import importlib.util | ||
15 | 17 | ||
16 | from wic import WicError | 18 | from wic import WicError |
17 | from wic.misc import get_bitbake_var | 19 | from wic.misc import get_bitbake_var |
@@ -54,7 +56,9 @@ class PluginMgr: | |||
54 | mname = fname[:-3] | 56 | mname = fname[:-3] |
55 | mpath = os.path.join(ppath, fname) | 57 | mpath = os.path.join(ppath, fname) |
56 | logger.debug("loading plugin module %s", mpath) | 58 | logger.debug("loading plugin module %s", mpath) |
57 | SourceFileLoader(mname, mpath).load_module() | 59 | spec = importlib.util.spec_from_file_location(mname, mpath) |
60 | module = importlib.util.module_from_spec(spec) | ||
61 | spec.loader.exec_module(module) | ||
58 | 62 | ||
59 | return PLUGINS.get(ptype) | 63 | return PLUGINS.get(ptype) |
60 | 64 | ||