def loadBundle(path): """Load a plugin bundle that may contain multiple .py modules, plus directories. The bundle directories will be included in file searching in paths.py. @param path The location of the plugin bundle. """ contentsPath = os.path.join(path, 'Contents') # Include the bundle contents in the module search path (for the # duration of this function). oldSysPath = sys.path sys.path = [contentsPath] + sys.path # Register the bundle path into paths.py. paths.addBundlePath(contentsPath) # Make the appropriate calls to read the configuration and # language files in the bundle. readBundleConfig(contentsPath) # Load all of the .py modules in the bundle's Python package. package = paths.getBase(path) packagePath = os.path.join(contentsPath, package) for name in os.listdir(packagePath): fullName = os.path.join(packagePath, name) if name != '__init__.py' and paths.hasExtension('py', fullName): loadSingle(fullName, package) # Restore the previous module search path. sys.path = oldSysPath
def __init__(self, identifier, source): Addon.__init__(self, identifier, source) # Register the source directory into the paths. paths.addBundlePath(self.getContentPath()) # Lists of addon identifiers. These are the parts of the box. self.required = [] self.optional = [] self.extra = []
def __init__(self, identifier, source): Addon.__init__(self, identifier, source) # Register the source directory into the paths. paths.addBundlePath(self.getContentPath())