From 55b8eb843939647eee937b62ed14f0e318704071 Mon Sep 17 00:00:00 2001 From: bamsumit Date: Thu, 28 Jul 2022 16:13:29 -0400 Subject: [PATCH] Process module search fix (#285) * update refport unittest to always wait when it writes to port for consistent behavior Signed-off-by: bamsumit * Removed pyproject changes Signed-off-by: bamsumit * Fix to convolution tests. Fixed imcompatible mnist_pretrained for old python versions. Signed-off-by: bamsumit * Missing moudle parent fix Signed-off-by: bamsumit --- src/lava/magma/compiler/compiler_graphs.py | 31 +++++++++++----------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/lava/magma/compiler/compiler_graphs.py b/src/lava/magma/compiler/compiler_graphs.py index b25e4736d..9197fdb8a 100644 --- a/src/lava/magma/compiler/compiler_graphs.py +++ b/src/lava/magma/compiler/compiler_graphs.py @@ -811,23 +811,24 @@ def _find_proc_models(proc: AbstractProcess) \ if not proc_module.__name__ == "__main__": # Get the parent module. module_spec = importlib.util.find_spec(proc_module.__name__) - parent_module = importlib.import_module(module_spec.parent) - - # Get all the modules inside the parent (namespace) module. This - # is required here, because the namespace module can span multiple - # repositories. - namespace_module_infos = list( - pkgutil.iter_modules( - parent_module.__path__, - parent_module.__name__ + "." + if module_spec.parent: + parent_module = importlib.import_module(module_spec.parent) + + # Get all the modules inside the parent (namespace) module. + # This is required here, because the namespace module can span + # multiple repositories. + namespace_module_infos = list( + pkgutil.iter_modules( + parent_module.__path__, + parent_module.__name__ + "." + ) ) - ) - # Extract the directory name of each module. - for _, name, _ in namespace_module_infos: - module = importlib.import_module(name) - module_dir_name = os.path.dirname(inspect.getfile(module)) - dir_names.append(module_dir_name) + # Extract the directory name of each module. + for _, name, _ in namespace_module_infos: + module = importlib.import_module(name) + module_dir_name = os.path.dirname(inspect.getfile(module)) + dir_names.append(module_dir_name) # Go through all directories and extract all the ProcModels. for dir_name in dir_names: