From 070a2ef8d7409dda4ab97d877e08d307a903d8dd Mon Sep 17 00:00:00 2001 From: Michal Reznik Date: Sun, 7 Apr 2024 18:08:05 +0200 Subject: [PATCH] draft: Fix FileFinder error --- leapp/repository/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/leapp/repository/__init__.py b/leapp/repository/__init__.py index b47af3e71..b7b05a4b1 100644 --- a/leapp/repository/__init__.py +++ b/leapp/repository/__init__.py @@ -2,6 +2,7 @@ import os import pkgutil import sys +import importlib.util from leapp.exceptions import RepoItemPathDoesNotExistError, UnsupportedDefinitionKindError from leapp.models import get_models, resolve_model_references @@ -166,7 +167,9 @@ def _load_modules(self, modules, prefix): directories = [os.path.join(self._repo_dir, os.path.dirname(module)) for module in modules] prefix = prefix + '.' if not prefix.endswith('.') else prefix for importer, name, ispkg in pkgutil.iter_modules(directories, prefix=prefix): - importer.find_module(name).load_module(name) + loader = importer.find_spec(name).loader + module = importlib.util.module_from_spec(loader) + loader.exec_module(module) def serialize(self): """