def __checkPlugin(self, main): try: type(main.userConf) type(main.actionConf) type(main.action) except AttributeError as e: raise( cException(e_plCompatibilityFail, e) )
def __checkMConf(self, mconf): try: type(mconf.install.mname) type(mconf.plugin.name) type(mconf.plugin.eps) type(mconf.plugin.description) type(mconf.plugin.version) type(mconf.plugin.authors) type(mconf.plugin.home) except AttributeError as e: raise( cException(e_plMConfCorrupt, str(e)) )
def load(self, installTranslator): self.badPlugins = [] for fConf in glob.glob(const.USER_PLUGIN_PATH+"/*.conf"): mconf = loadConfig(fConf) try: self.__checkMConf(mconf) except cException as e: e.data += " "+fConf self.badPlugins.append(e) else: try: mconf.plugin.description = unicode(vars(mconf.plugin)["description-"+self.locale]) except: pass if mconf.plugin.eps == const.EPS: try: main = __import__(mconf.install.mname+"."+const.PLUGIN_MAIN_MODULE).main except Exception as e: self.badPlugins.append( cException(e_plImportError, "%s: %s" %(str(e), mconf.install.mname)) ) else: try: self.__checkPlugin(main) except cException as e: e.data = "%s, %s" %(mconf.install.mname, str(e.data)) self.badPlugins.append( e ) else: main.mconf = mconf main.installTranslator = installTranslator self.__list[mconf.plugin.name] = main self.__mnameIndex[mconf.install.mname] = mconf.plugin.name else: e = cException(e_plEPSConflict, "%s: %s \n evire: %s" %(mconf.install.mname, mconf.plugin.eps, const.EPS)) self.badPlugins.append(e) self.__buildExtensionList() if self.badPlugins: raise( cException(e_plbadPluginsFound, str(len(self.badPlugins))) ) '''for __f in glob.glob(const.USER_PLUGIN_PATH+"/*.py") + glob.glob(const.SYSTEM_PLUGIN_PATH+"/*.py"):