So, based on importlib
documentation I figured I might be able to replace imp.find_module
+ imp.load_module
with:
spec = importlib.machinery.PathFinder.find_spec(modname, [""])
mod = importlib.util.module_from_spec(spec)
spec.loader.exec_module(mod)
sys.modules[modname] = mod
However, I still don’t know if this:
- is actually correct
- is the one obvious way to do it
(Full patch available in Fedora or upstream.)