Coverage for ion/core/cc/modloader : 47.06%
Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
|
#!/usr/bin/env python
@file ion/core/cc/modloader.py @author Michael Meisinger @brief loads modules in given list of """
""" Loads all modules in given list of modules and packages """
""" Loads modules, such that static code gets executed @todo Should this be twisted friendly generator? """ mods = CF_modules_cfg # This should only apply if called with default arguments return
raise RuntimeError("Entries in module list must be str") self._load_package(mod[:len(mod)-3], True) self._load_package(mod[:len(mod)-2], False) else:
#log.info('Loading Module %s' % (mod)) except Exception, ie: log.error("Error importing module: " + str(mod)) bugstr = "Error importing module: " + str(mod) + '\n' + str(ie) for line in traceback.format_exc().splitlines(): bugstr += line + '\n' log.debug(bugstr)
#log.info('Loading Package %s' % (pack)) try: packo = pu.get_module(pack) ppath = packo.__path__ for path1 in ppath: dirList=os.listdir(path1) for fname in dirList: if fname.endswith('.py') and fname != '__init__.py': self._load_module(pack+'.'+fname[:len(fname)-3]) elif os.path.isdir(os.path.join(path1,fname)) and recurse: self._load_package(pack+'.'+fname) except Exception, ie: log.error("Error importing package: " + str(pack)) bugstr = "Error importing package: " + str(pack) + '\n' + str(ie) for line in traceback.format_exc().splitlines(): bugstr += line + '\n' log.debug(bugstr) |