[yum-git] 2 commits - yum/plugins.py

James Antill james at linux.duke.edu
Wed Mar 19 16:21:13 UTC 2008


 yum/plugins.py |   19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

New commits:
commit 8ddd3b07416fdd943960aa2bbd6de40900bcfbad
Author: James Antill <james at and.org>
Date:   Wed Mar 19 12:19:57 2008 -0400

     Merge output for multiple dirs. of plugins.
     Don't output empty line when disabling all plugins.
     Output disableplugin args that don't match anything.

diff --git a/yum/plugins.py b/yum/plugins.py
index bcec78f..1624c7e 100644
--- a/yum/plugins.py
+++ b/yum/plugins.py
@@ -183,21 +183,29 @@ class YumPlugins:
             self._pluginfuncs[slot] = []
 
         # Import plugins 
+        self._used_disable_plugin = set()
         for dir in self.searchpath:
             if not os.path.isdir(dir):
                 continue
             for modulefile in glob.glob('%s/*.py' % dir):
                 self._loadplugin(modulefile, types)
-            plugins = sorted(self._plugins)
 
+        if self._plugins:
             # Mostly copied from YumOutput._outKeyValFill()
             key = _("Loaded plugins: ")
-            val = ", ".join(plugins)
+            val = ", ".join(sorted(self._plugins))
             nxt = ' ' * (len(key) - 2) + ': '
             self.verbose_logger.log(logginglevels.INFO_2,
                                     fill(val, width=80, initial_indent=key,
                                          subsequent_indent=nxt))
 
+        if self.disabledPlugins:
+            for wc in self.disabledPlugins:
+                if wc not in self._used_disable_plugin:
+                    self.verbose_logger.log(logginglevels.INFO_2,
+                                            _("No plugin match for: %s") % wc)
+        del self._used_disable_plugin
+
     def _loadplugin(self, modulefile, types):
         '''Attempt to import a plugin module and register the hook methods it
         uses.
@@ -250,6 +258,7 @@ class YumPlugins:
         if self.disabledPlugins:
             for wc in self.disabledPlugins:
                 if fnmatch.fnmatch(modname, wc):
+                    self._used_disable_plugin.add(wc)
                     return
 
         self.verbose_logger.log(logginglevels.DEBUG_3, _('Loading "%s" plugin'),
commit 981bc3648224ab0d6a3735c449a3efe4b184179d
Author: James Antill <james at and.org>
Date:   Wed Mar 19 12:10:37 2008 -0400

    Add wildcard support to disableplugin

diff --git a/yum/plugins.py b/yum/plugins.py
index 753b445..bcec78f 100644
--- a/yum/plugins.py
+++ b/yum/plugins.py
@@ -33,6 +33,7 @@ from parser import ConfigPreProcessor
 from textwrap import fill
 from i18n import _
 
+import fnmatch
 
 # TODO: expose rpm package sack objects to plugins (once finished)
 # TODO: allow plugins to use the existing config stuff to define options for
@@ -247,8 +248,9 @@ class YumPlugins:
                 return
         # Check if this plugin has been temporary disabled
         if self.disabledPlugins:
-            if modname in self.disabledPlugins:
-                return
+            for wc in self.disabledPlugins:
+                if fnmatch.fnmatch(modname, wc):
+                    return
 
         self.verbose_logger.log(logginglevels.DEBUG_3, _('Loading "%s" plugin'),
                                 modname)



More information about the Yum-cvs-commits mailing list