[yum-commits] 2 commits - plugins/list-data yum-groups-manager.py

James Antill james at osuosl.org
Thu Oct 16 14:27:12 UTC 2008


 plugins/list-data/list-data.py |   23 ++++++++++++++++-------
 yum-groups-manager.py          |    3 ++-
 2 files changed, 18 insertions(+), 8 deletions(-)

New commits:
commit 851d8ffe825cbfc107c392b4397e61b52f9dedcc
Author: James Antill <james at and.org>
Date:   Thu Oct 16 10:27:00 2008 -0400

    Fix translated names with full utf-8 in them

diff --git a/yum-groups-manager.py b/yum-groups-manager.py
index 9aa84e0..bb13b4e 100755
--- a/yum-groups-manager.py
+++ b/yum-groups-manager.py
@@ -8,6 +8,7 @@ import optparse
 import gzip
 
 import yum
+from yum.misc import to_unicode
 import yum.comps
 
 sys.path.insert(0, '/usr/share/yum-cli')
@@ -91,7 +92,7 @@ def trans_data(yb, inp):
     if not lang:
         yb.logger.error("Error: Incorrect/empty language for translated data")
         sys.exit(50)
-    return lang, text
+    return lang, to_unicode(text)
 
 __req2pkgs = {}
 def req2pkgs(yb, req):
commit 7efa2f78a0f5748f26b20be938aebaf9327c07d6
Author: James Antill <james at and.org>
Date:   Thu Oct 16 10:01:29 2008 -0400

    Don't output the cli object in the help, fixes bug 467191

diff --git a/plugins/list-data/list-data.py b/plugins/list-data/list-data.py
index 5744ff5..f0cd8d4 100755
--- a/plugins/list-data/list-data.py
+++ b/plugins/list-data/list-data.py
@@ -56,9 +56,10 @@ plugin_type = (TYPE_INTERACTIVE,)
 class ListDataCommands:
     unknown = "-- Unknown --"
     
-    def __init__(self, name, attr):
+    def __init__(self, name, attr, help=None):
         self.name = name
         self.attr = attr
+        self.__help = help
 
     def cmd_beg(self):
         pass
@@ -73,6 +74,8 @@ class ListDataCommands:
         return "[PACKAGE|all|installed|updates|extras|obsoletes|recent]"
 
     def _getSummary(self):
+        if self.__help is not None:
+            return self.__help
         return """\
 Display aggregate data on the %s attribute of a group of packages""" % self.attr
 
@@ -289,8 +292,11 @@ def yum_group_get_data(self, pkg):
         return (self.unknown, self.unknown)
     return (all_yum_grp_mbrs[pkg.name], all_yum_grp_mbrs[pkg.name])
 
-def _list_data_custom(conduit, data, func, beg=None, end=None):
-    cmd = ListDataCommands(*data)
+def _list_data_custom(conduit, data, func, beg=None, end=None, help=None):
+    if help is not None:
+        cmd = ListDataCommands(data[0], data[1], help=help)
+    else:
+        cmd = ListDataCommands(*data)
     cmd.oget_data = cmd.get_data 
     cmd.get_data  = types.MethodType(func, cmd)
     if beg:
@@ -299,7 +305,10 @@ def _list_data_custom(conduit, data, func, beg=None, end=None):
         cmd.cmd_end = types.MethodType(end, cmd)
     conduit.registerCommand(cmd)
 
-    cmd = InfoDataCommands(*data)
+    if help is not None:
+        cmd = InfoDataCommands(data[0], data[1], help=help)
+    else:
+        cmd = InfoDataCommands(*data)
     cmd.oget_data = cmd.get_data 
     cmd.get_data  = types.MethodType(func, cmd)
     if beg:
@@ -308,7 +317,6 @@ def _list_data_custom(conduit, data, func, beg=None, end=None):
         cmd.cmd_end = types.MethodType(end, cmd)
     conduit.registerCommand(cmd)
     
-        
 def config_hook(conduit):
     '''
     Yum Plugin Config Hook: 
@@ -331,9 +339,10 @@ def config_hook(conduit):
     _list_data_custom(conduit, ('archive-sizes', 'archivesize'), size_get_data)
     _list_data_custom(conduit, ('installed-sizes', 'installedsize'),
                       size_get_data)
-    
+
     _list_data_custom(conduit, ('groups', conduit._base),
                       yum_group_get_data,
-                      beg=yum_group_make_data, end=yum_group_free_data)
+                      beg=yum_group_make_data, end=yum_group_free_data,
+                      help='Display aggregate group data, for matching members')
     
     # Buildtime/installtime/committime?


More information about the Yum-commits mailing list