예제 #1
0
파일: config.py 프로젝트: minikiller/zou
 def initConfig(self, filename="vb2py.ini", path=None):
     """Read the values"""
     if path is None:
         path = rootPath()
     self._config = ConfigParser.ConfigParser()
     self._config.read(os.path.join(path, filename))
     self._local_overide = {}
예제 #2
0
def loadAllPlugins():
    """Load all plug-ins from the plug-in directory and return a list of all the classes"""
    import plugins
    mods = []
    for mod in plugins.mods:
        log.info("Checking '%s' for plugins" % mod)
        #
        f = open(os.path.join(rootPath(), "plugins", "%s.py" % mod), "r")
        try:
            try:
                m = imp.load_module(mod, f, "Plugin-%s" % mod, ('*.py', 'r', 1))
            finally:
                f.close()
        except Exception, err:
            log.warn("Error importing '%s' (%s). Module skipped" % (mod, err))
            continue
        #
        for name in dir(m):
            cls = getattr(m, name)
            #import pdb; pdb.set_trace()
            try:
                is_plugin = cls.__is_plugin__
            except AttributeError:
                is_plugin = 0
            if is_plugin:
                try:
                    p = cls()               
                    log.info("Added new plug-in: '%s" % p.name)
                    mods.append(p)
                except Exception, err:
                    log.warn("Error creating plugin '%s' (%s). Class skipped" % (cls, err))
예제 #3
0
파일: config.py 프로젝트: denfromufa/vb2py
 def initConfig(self, filename="vb2py.ini", path=None):
     """Read the values"""
     if path is None:
         path = rootPath()
     self._config = ConfigParser.ConfigParser()
     self._config.read(os.path.join(path, filename))
     self._local_overide = {}	
예제 #4
0
def loadAllPlugins():
    """Load all plug-ins from the plug-in directory and return a list of all the classes"""
    import plugins
    mods = []
    for mod in plugins.mods:
        log.info("Checking '%s' for plugins" % mod)
        #
        f = open(os.path.join(rootPath(), "plugins", "%s.py" % mod), "r")
        try:
            try:
                m = imp.load_module(mod, f, "Plugin-%s" % mod,
                                    ('*.py', 'r', 1))
            finally:
                f.close()
        except Exception, err:
            log.warn("Error importing '%s' (%s). Module skipped" % (mod, err))
            continue
        #
        for name in dir(m):
            cls = getattr(m, name)
            #import pdb; pdb.set_trace()
            try:
                is_plugin = cls.__is_plugin__
            except AttributeError:
                is_plugin = 0
            if is_plugin:
                try:
                    p = cls()
                    log.info("Added new plug-in: '%s" % p.name)
                    mods.append(p)
                except Exception, err:
                    log.warn("Error creating plugin '%s' (%s). Class skipped" %
                             (cls, err))
예제 #5
0
 def __init__(self, basesourcefile=None):
     """Initialize the resource"""
     if basesourcefile is None:
         self.basesourcefile = os.path.join(rootPath(), "targets",
                                            self.target_name, "basesource")
     else:
         self.basesourcefile = basesourcefile
     #
     # Apply default resource
     self._rsc = {}
     self._code = ""
     #
     log.info("BaseResource init")
예제 #6
0
 def __init__(self, basesourcefile=None):
     """Initialize the resource"""
     if basesourcefile is None:
         self.basesourcefile = os.path.join(
                     rootPath(), "targets", self.target_name, "basesource")
     else:
         self.basesourcefile = basesourcefile
     #
     # Apply default resource
     self._rsc = {}
     self._code = ""
     #
     log.debug("BaseResource init")