def _harvest_plugins_in_eggs(self, application): """ Harvest plugins found in eggs on the plugin path. """ # We first add the eggs to a local working set so that when we get # the plugin entry points we don't pick up any from other eggs # installed on sys.path. plugin_working_set = pkg_resources.WorkingSet(self.plugin_path) add_eggs_on_path(plugin_working_set, self.plugin_path) # We also add the eggs to the global working set as otherwise the # plugin classes can't be imported! add_eggs_on_path(pkg_resources.working_set, self.plugin_path) plugins = [] for entry_point in self._get_plugin_entry_points(plugin_working_set): if self._include_plugin(entry_point.name): try: plugin = self._create_plugin_from_entry_point(entry_point, application) plugins.append(plugin) except Exception as exc: exc_tb = traceback.format_exc() msg = 'Error loading plugin: %s (from %s)\n%s'\ %(entry_point.name, entry_point.dist.location, exc_tb) logger.error(msg) self.on_broken_plugin(entry_point, exc) return plugins
def _harvest_plugins_in_eggs(self, application): """ Harvest plugins found in eggs on the plugin path. """ # We first add the eggs to a local working set so that when we get # the plugin entry points we don't pick up any from other eggs # installed on sys.path. plugin_working_set = pkg_resources.WorkingSet(self.plugin_path) add_eggs_on_path(plugin_working_set, self.plugin_path) # We also add the eggs to the global working set as otherwise the # plugin classes can't be imported! add_eggs_on_path(pkg_resources.working_set, self.plugin_path) plugins = [ self._create_plugin_from_entry_point(ep, application) for ep in self._get_plugin_entry_points(plugin_working_set) if self._include_plugin(ep.name) ] return plugins