Exemplo n.º 1
0
 def reloadBundles(self, namespace):
     installedBundles = [bundle for bundle in self.getAllBundles() 
         if bundle.hasSource(namespace.name)]
     base = os.path.join(namespace.path, config.PMX_BUNDLES_NAME)
     paths_to_find = list(Bundle.sourcePaths(base))
     for bundle in installedBundles:
         source = bundle.getSource(namespace.name)
         if source.exists():
             if source == bundle.currentSource() and source.hasChanged():
                 self.loadBundle(source)
                 self.modifyBundle(bundle)
             paths_to_find.remove(source.path)
         else:
             bundleItems = self.findBundleItems(bundle=bundle)
             for item in bundleItems:
                 item.removeSource(namespace.name)
             bundle.removeSource(namespace.name)
             if not bundle.hasSources():
                 logger.debug("Bundle %s removed." % bundle.name)
                 for item in bundleItems:
                     self.removeManagedObject(item)
                     self.onBundleItemRemoved(item)
                 self.removeManagedObject(bundle)
                 self.removeBundle(bundle)
             else:
                 for item in bundleItems:
                     item.setDirty()
                 bundle.setSupportPath(None)
                 bundle.setDirty()
     for path in paths_to_find:
         logger.debug("New bundle %s." % path)
         bundle_source = source.Source(namespace.name, path)
         bundle = self.loadBundle(bundle_source)
Exemplo n.º 2
0
 def sourceHasChanged(self, name):
     source = self.sources[name]
     return source.hasChanged()