def __load_plugins(self): """Load all plugins by looking at the available plugin groups and calling createPlugins on a package, if it exists. the createPlugins function is responsible for creating the plugin """ self.__plugins = {} groups = loader.plugin_groups_iterator(self.plugin_base, "createPlugins") for group, createPlugins in groups: if createPlugins: self.logger.debug("Package has plugins: %s" % group) createPlugins(self) else: self.logger.debug("Package has no plugins: %s" % group)
class CpeProperty(Property): description = "This feature represents the CPE of this product" name = "version" namespace = "cpe" value = SystemRelease().cpe() if __name__ == "__main__": # Create a feature registry registry = Registry() # Statically register a feature which represents the version registry.register(CpeProperty(owner=Owner(name=__name__))) # Now go through all plugins and see if they want to publish sth too groups = loader.plugin_groups_iterator(setup, "createPluginFeatures") for group, createPluginFeatures in groups: if createPluginFeatures: logging.info("Registering feature from %s" % group) createPluginFeatures(registry) # The registry is now build time to publish it if "-d" in sys.argv: # Via a http daemon launch_bottle(registry) elif "dumpxml" in sys.argv: # In XML to stdout xmlbuilder = XmlBuilder() print(xmlbuilder.build(registry)) else: