25 CONFIG_EXT =
"manager.modules.config_ext" 26 CONFIG_PATH =
"manager.modules.config_path" 27 DETECT_MOD =
"manager.modules.detect_loadable" 28 MOD_LOADPTH =
"manager.modules.load_path" 29 INITFUNC_SFX =
"manager.modules.init_func_suffix" 30 INITFUNC_PFX =
"manager.modules.init_func_prefix" 31 ALLOW_ABSPATH =
"manager.modules.abs_path_allowed" 32 ALLOW_URL =
"manager.modules.download_allowed" 33 MOD_DWNDIR =
"manager.modules.download_dir" 34 MOD_DELMOD =
"manager.modules.download_cleanup" 35 MOD_PRELOAD =
"manager.modules.preload" 82 OpenRTM_aist.eraseHeadBlank(tmp)
87 OpenRTM_aist.eraseHeadBlank(tmp)
100 self.
_mgr = OpenRTM_aist.Manager.instance()
153 ModuleManager.NotFound.__init__(self, name_)
166 ModuleManager.NotFound.__init__(self, name_)
179 ModuleManager.NotFound.__init__(self, name_)
192 ModuleManager.Error.__init__(self, reason_)
193 ModuleManager.Error.__init__(self, reason_)
206 ModuleManager.Error.__init__(self, reason_)
219 ModuleManager.Error.__init__(self, reason_)
245 def load(self, file_name, init_func=None):
247 self.
_rtcout = self._mgr.getLogbuf(
"ModuleManager")
249 self._rtcout.RTC_TRACE(
"load(fname = %s)", file_name)
253 if OpenRTM_aist.isURL(file_name):
259 import_name = os.path.split(file_name)[-1]
262 if OpenRTM_aist.isAbsolutePath(file_name):
266 splitted_name = os.path.split(file_name)
267 save_path = sys.path[:]
268 sys.path.append(splitted_name[0])
270 import_name = splitted_name[-1]
271 file_path = file_name
282 splitted_name = os.path.split(file_path)
283 sys.path.append(splitted_name[0])
285 ext_pos = import_name.find(
".py")
287 import_name = import_name[:ext_pos]
288 mo = __import__(str(import_name))
294 dll.properties.setProperty(
"file_path",file_path)
295 self._modules.registerObject(dll)
298 if init_func
is None:
319 dll = self._modules.find(file_name)
323 self._modules.unregisterObject(file_name)
339 dlls = self._modules.getObjects()
342 ident = dll.properties.getProperty(
"file_path")
343 self._modules.unregisterObject(ident)
361 dll = self._modules.find(file_name)
365 func = getattr(dll.dll,func_name,
None)
420 for path
in load_path:
421 self._loadPath.append(path)
440 dlls = self._modules.getObjects()
443 modules.append(dll.properties)
452 dirname = os.path.dirname(fname)
453 sys.path.append(dirname)
455 basename = os.path.basename(fname)
457 classname = basename.split(
".")[0].lower()
461 oldp = self._mgr.getFactoryProfiles()
464 comp_spec_name = classname+
"_spec" 467 imp_file = __import__(basename.split(
".")[0])
470 comp_spec = getattr(imp_file,comp_spec_name,
None)
478 for i
in range(len(oldp)):
479 if oldp[i].getProperty(
"implementation_id") == newp.getProperty(
"implementation_id")
and \
480 oldp[i].getProperty(
"type_name") == newp.getProperty(
"type_name")
and \
481 oldp[i].getProperty(
"description") == newp.getProperty(
"description")
and \
482 oldp[i].getProperty(
"version") == newp.getProperty(
"version"):
518 flist = glob.glob(path + os.sep +
'*.py')
520 if file.find(
"__init__.py") == -1:
521 modules_.append(file)
525 for mod_
in modules_:
528 prop.setProperty(
"module_file_name",os.path.basename(mod_))
529 prop.setProperty(
"module_file_path", mod_)
615 for path
in load_path:
616 if fname.find(
".py") == -1:
617 f = str(path) + os.sep + str(file_name)+
".py" 619 f = str(path)+ os.sep + str(file_name)
641 if fname.find(
".py") == -1:
642 fname = str(filename)+
".py" 644 if os.path.isfile(fname):
666 base_name = os.path.basename(file_path)
695 return self.
_filepath == dll.properties.getProperty(
"file_path")
def __getRtcProfile(self, fname)
def disallowModuleDownload(self)
Forbid module download.
def getInitFuncName(self, file_path)
Create initialize function symbol.
def __init__(self, reason_)
def findFile(self, fname, load_path)
Search file from load path.
def __init__(self, name_)
def unload(self, file_name)
Unload module.
def __init__(self, reason_)
def split(input, delimiter)
Split string by delimiter.
def allowAbsolutePath(self)
Allow absolute load path.
The Properties class represents a persistent set of properties.
def __init__(self, reason_)
def getLoadedModules(self)
Get loaded module names std::vector<coil::Properties> getLoadedModules();.
def __del__(self)
destructor
def symbol(self, file_name, func_name)
Look up a named symbol in the module.
def addLoadpath(self, load_path)
Add module load path.
def disallowAbsolutePath(self)
Forbid absolute load path.
def __init__(self, name_)
def __init__(self, reason_)
def __init__(self, name_)
def unloadAll(self)
Unload all modules.
def fileExist(self, filename)
Check file existance.
def load(self, file_name, init_func=None)
Load module.
def getLoadPath(self)
Get default module load path.
def __init__(self, name_)
def __init__(self, dll, prop)
def allowModuleDownload(self)
Allow module download.
def __init__(self, name=None, factory=None)
def setLoadpath(self, load_path_list)
Set default module load path.
def __init__(self, prop)
constructor
def getLoadableModules(self)
Get loadable module names.