From 7784756a69fbc9697966587d9ebb3c8db392293f Mon Sep 17 00:00:00 2001 From: Nobuhiko Miyamoto Date: Mon, 29 Jul 2024 08:47:30 +0900 Subject: [PATCH 1/2] [incompat] fixed bugs. --- OpenRTM_aist/Manager.py | 15 +++++++++++++-- OpenRTM_aist/ModuleManager.py | 16 +++++++++++++--- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/OpenRTM_aist/Manager.py b/OpenRTM_aist/Manager.py index 2abd60ef..3e6fc3f1 100644 --- a/OpenRTM_aist/Manager.py +++ b/OpenRTM_aist/Manager.py @@ -568,6 +568,17 @@ def join(self): def load(self, fname, initfunc): self._rtcout.RTC_TRACE("Manager.load(fname = %s, initfunc = %s)", (fname, initfunc)) + prop = OpenRTM_aist.Properties() + prop.setProperty("module_file_name", fname) + + return self.load_prop(prop, initfunc) + + def load_prop(self, prop, initfunc): + self._rtcout.RTC_TRACE("Manager.load(module_file_name = %s, module_file_path = %s, language = %s, initfunc = %s)", + (prop.getProperty("module_file_name"), + prop.getProperty("module_file_path"), + prop.getProperty("language"))) + fname = prop.getProperty("module_file_name") fname = fname.replace("/", os.sep) fname = fname.replace("\\", os.sep) fname, initfunc = self._listeners.module_.preLoad(fname, initfunc) @@ -582,7 +593,7 @@ def load(self, fname, initfunc): if not initfunc: mod = [s.strip() for s in fname_.split(".")] initfunc = mod[0] + "Init" - path = self._module.load(fname, initfunc) + path = self._module.load_prop(prop, initfunc) self._rtcout.RTC_DEBUG("module path: %s", path) path, initfunc = self._listeners.module_.postLoad(path, initfunc) except OpenRTM_aist.ModuleManager.NotAllowedOperation as e: @@ -946,7 +957,7 @@ def createComponent(self, comp_args): self._rtcout.RTC_INFO( "Loading module: %s", found_obj.getProperty("module_file_path")) - self.load(found_obj.getProperty("module_file_path"), "") + self.load_prop(found_obj, "") factory = self._factory.find(comp_id) if not factory: self._rtcout.RTC_ERROR("Factory not found for loaded module: %s", diff --git a/OpenRTM_aist/ModuleManager.py b/OpenRTM_aist/ModuleManager.py index e7589048..30bf7f06 100644 --- a/OpenRTM_aist/ModuleManager.py +++ b/OpenRTM_aist/ModuleManager.py @@ -246,8 +246,19 @@ def __init__(self, reason_): # std::string ModuleManager::load(const std::string& file_name, # const std::string& init_func) def load(self, file_name, init_func=None): - self._rtcout.RTC_TRACE("load(fname = %s)", file_name) + + prop = OpenRTM_aist.Properties() + prop.setProperty("module_file_name", file_name) + return self.load_prop(prop, init_func) + + def load_prop(self, prop, init_func=None): + self._rtcout.RTC_TRACE("load(module_file_name = %s, module_file_path = %s, language = %s)", + (prop.getProperty("module_file_name"), + prop.getProperty("module_file_path"), + prop.getProperty("language"))) + file_name = prop.getProperty("module_file_name") + file_path = prop.getProperty("module_file_path") if file_name == "": raise ModuleManager.InvalidArguments("Invalid file name.") @@ -260,7 +271,6 @@ def load(self, file_name, init_func=None): import_name = os.path.split(file_name)[-1] pathChanged = False - file_path = None if OpenRTM_aist.isAbsolutePath(file_name): if not self._absoluteAllowed: @@ -275,8 +285,8 @@ def load(self, file_name, init_func=None): import_name = splitted_name[-1] file_path = file_name - else: paths = self._properties.getProperty( + elif not file_path: "manager.modules.Python.load_paths").split(",") paths.extend(self._properties.getProperty( "manager.modules.Python3.load_paths").split(",")) From ac1f3880296580d0ea25ca095eec7af18dc1dac7 Mon Sep 17 00:00:00 2001 From: Nobuhiko Miyamoto Date: Mon, 29 Jul 2024 08:54:40 +0900 Subject: [PATCH 2/2] [compat] ffixed bugs. --- OpenRTM_aist/ModuleManager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenRTM_aist/ModuleManager.py b/OpenRTM_aist/ModuleManager.py index 30bf7f06..4ecd5a1c 100644 --- a/OpenRTM_aist/ModuleManager.py +++ b/OpenRTM_aist/ModuleManager.py @@ -285,8 +285,8 @@ def load_prop(self, prop, init_func=None): import_name = splitted_name[-1] file_path = file_name - paths = self._properties.getProperty( elif not file_path: + paths = self._properties.getProperty( "manager.modules.Python.load_paths").split(",") paths.extend(self._properties.getProperty( "manager.modules.Python3.load_paths").split(","))