summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic/pluginbase.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2022-01-04 23:06:50 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-01-05 17:18:16 +0000
commitfc2bc42eecfb03c6bf8d35b4ef2d3af6a5f13fcb (patch)
treea88585d48be35b5424e06f1a4e882f0b270e26d7 /scripts/lib/wic/pluginbase.py
parent6209684ca67e8d683d096e07c6cf0543928fe138 (diff)
downloadpoky-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.py8
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
10import os 10import os
11import logging 11import logging
12import types
12 13
13from collections import defaultdict 14from collections import defaultdict
14from importlib.machinery import SourceFileLoader 15import importlib
16import importlib.util
15 17
16from wic import WicError 18from wic import WicError
17from wic.misc import get_bitbake_var 19from 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