def loadAll(): """Load the <tt>.lang</tt> files from the lang directories. """ for fileName in paths.listFiles(paths.LANG, False): # We'll load all the files with the .lang extension. if paths.hasExtension('lang', fileName): # Load this language file. load(fileName)
def getLanguages(): langs = [] for fileName in paths.listFiles(paths.LANG): # We'll load all the files with the .lang extension. if paths.hasExtension('lang', fileName): langs.append(paths.getBase(fileName)) return langs
def loadAll(): """Load all addons and manifests.""" # Load all the installed addons in the system and user addon # databases. for repository in [paths.ADDONS] + paths.getAddonPaths(): for name in paths.listFiles(repository): # Case insensitive. if re.search("(?i)^([^.#].*)\.(" + string.join(ao.EXTENSIONS, "|") + ")$", os.path.basename(name)): load(name) # Load all the manifests. for folder in [paths.getSystemPath(paths.MANIFESTS), paths.getUserPath(paths.MANIFESTS)] + paths.getAddonPaths(): for name in paths.listFiles(folder): # Case insensitive. if paths.hasExtension("manifest", name): loadManifest(name)
def loadAll(): """Load all addons and manifests.""" # Load all the installed addons in the system and user addon # databases. for repository in [paths.ADDONS] + paths.getAddonPaths(): for name in paths.listFiles(repository): # Case insensitive. if re.search("(?i)^([^.#].*)\.(" + \ string.join(ao.EXTENSIONS, '|') + ")$", os.path.basename(name)): load(name) # Load all the manifests. for folder in [paths.getSystemPath(paths.MANIFESTS), paths.getUserPath(paths.MANIFESTS)] + \ paths.getAddonPaths(): for name in paths.listFiles(folder): # Case insensitive. if paths.hasExtension('manifest', name): loadManifest(name)
def loadAll(): "Load all the plugins from the plugins directory." global initCommands initCommands = [] # We'll only use the modified sys.path during this function. oldPath = sys.path # Make the plugins directory the one where to look first. sys.path = [PLUGIN_PATH] + sys.path found = [] for fileName in paths.listFiles(paths.PLUGINS): if paths.hasExtension('py', fileName) or \ (paths.hasExtension('plugin', fileName) and os.path.isdir(fileName)): if fileName not in found: found.append(fileName) # Sort alphabetically across all located plugins. found.sort(key=sortKey) for fileName in found: if paths.hasExtension('py', fileName): loadSingle(fileName) # Single Python module. elif paths.hasExtension('plugin', fileName): loadBundle(fileName) # A plugin bundle. # Import all plugin modules. for importStatement, initStatement, searchPath in initCommands: sys.path = searchPath try: exec importStatement except: logger.add(logger.HIGH, 'error-plugin-init-failed', importStatement, logger.formatTraceback()) # Initialize all plugins. for importStatement, initStatement, searchPath in initCommands: sys.path = searchPath try: exec initStatement except AttributeError, ex: if "'init'" not in str(ex): logger.add(logger.HIGH, 'error-plugin-init-failed', initStatement, logger.formatTraceback()) except: