def reloadBundles(self, namespace): if 'Bundles' in self.namespaces[namespace]: installedBundles = filter(lambda theme: theme.hasNamespace(namespace), self.getAllBundles()) bundlePaths = glob(os.path.join(self.namespaces[namespace]['Bundles'], '*.tmbundle')) for bundle in installedBundles: bundlePath = bundle.path(namespace) if bundlePath in bundlePaths: if namespace == bundle.currentNamespace and bundle.sourceChanged(namespace): self.logger.debug("Bundle %s changed, reload from %s." % (bundle.name, bundlePath)) bundle.reloadBundle(bundle, bundlePath, namespace, self) bundle.updateMtime(namespace) self.modifyBundle(bundle) bundlePaths.remove(bundlePath) else: bundleItems = self.findBundleItems(bundle = bundle) map(lambda item: item.removeSource(namespace), bundleItems) bundle.removeSource(namespace) if not bundle.hasSources(): self.logger.debug("Bundle %s removed." % bundle.name) map(lambda item: self.removeManagedObject(item), bundleItems) map(lambda item: self.removeBundleItem(item), bundleItems) self.removeManagedObject(bundle) self.removeBundle(bundle) else: map(lambda item: item.setDirty(), bundleItems) bundle.support = None bundle.setDirty() for path in bundlePaths: self.logger.debug("New bundle %s." % path) PMXBundle.loadBundle(path, namespace, self)
def loadBundles(self, namespace): loadedBundles = set() if 'Bundles' in self.namespaces[namespace]: paths = glob(os.path.join(self.namespaces[namespace]['Bundles'], '*.tmbundle')) for path in paths: bundle = PMXBundle.loadBundle(path, namespace, self) if bundle is not None: loadedBundles.add(bundle) return loadedBundles