@@ -82,7 +82,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]
@@ -9,6 +9,7 @@ __all__ = ['ImagerPlugin', 'SourcePlugin']
import os
import logging
+import types
from collections import defaultdict
from importlib.machinery import SourceFileLoader
@@ -54,7 +55,9 @@ class PluginMgr:
mname = fname[:-3]
mpath = os.path.join(ppath, fname)
logger.debug("loading plugin module %s", mpath)
- SourceFileLoader(mname, mpath).load_module()
+ loader = SourceFileLoader(mname, mpath)
+ mod = types.ModuleType(loader.name)
+ loader.exec_module(mod)
return PLUGINS.get(ptype)
This is deprecated in python 3.12 and Fedora 35 is throwing warnings so move to the new functions. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> --- scripts/lib/scriptutils.py | 4 +++- scripts/lib/wic/pluginbase.py | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-)