[yum-commits] Branch 'yum-3_2_X' - 2 commits - yum/i18n.py yumcommands.py

James Antill james at osuosl.org
Mon Nov 3 22:14:16 UTC 2008


 yum/i18n.py    |   16 ++++++++++++++--
 yumcommands.py |   14 ++++++++++++++
 2 files changed, 28 insertions(+), 2 deletions(-)

New commits:
commit 432c7778384bf9bef4eb2f386ebcc608a598b4d7
Author: James Antill <james at and.org>
Date:   Mon Nov 3 17:01:00 2008 -0500

    Add bigger doc comments to utf8_width_chop and utf8_width_full

diff --git a/yum/i18n.py b/yum/i18n.py
index b1632ca..2d50e74 100755
--- a/yum/i18n.py
+++ b/yum/i18n.py
@@ -213,7 +213,9 @@ def utf8_width(msg):
 
 def utf8_width_chop(msg, chop=None):
     """ Return the textual width of a utf8 string, chopping it to a specified
-        value. """
+        value. This is what you want to use instead of %.*s, as it does the
+        "right" thing with regard to utf-8 sequences. Eg.
+        "%.*s" % (10, msg)   <= becomes => "%s" % (utf8_width_chop(msg, 10)) """
 
     if chop is None or utf8_width(msg) <= chop:
         return utf8_width(msg), msg
@@ -241,7 +243,17 @@ def utf8_width_chop(msg, chop=None):
 
 def utf8_width_fill(msg, fill, chop=None, left=True):
     """ Expand a utf8 msg to a specified "width" or chop to same.
-        Expansion can be left or right. """
+        Expansion can be left or right. This is what you want to use instead of
+        %*.*s, as it does the "right" thing with regard to utf-8 sequences.
+        Eg.
+        "%-*.*s" % (10, 20, msg)
+           <= becomes =>
+        "%s" % (utf8_width_fill(msg, 10, 20)).
+
+        "%20.10s" % (msg)
+           <= becomes =>
+        "%s" % (utf8_width_fill(msg, 20, 10, left=False)).
+        """
     passed_msg = msg
     width, msg = utf8_width_chop(msg, chop)
 
commit d5ff8d3f3f8017de3d8d98d24356c9d65f80f588
Author: James Antill <james at and.org>
Date:   Mon Nov 3 10:16:33 2008 -0500

    check-update -v lists obsoleted pkgs too, related to 462999

diff --git a/yumcommands.py b/yumcommands.py
index 7b0214f..6766593 100644
--- a/yumcommands.py
+++ b/yumcommands.py
@@ -536,11 +536,25 @@ class CheckUpdateCommand(YumCommand):
         result = 0
         try:
             ypl = base.returnPkgLists(extcmds)
+            if base.verbose_logger.isEnabledFor(logginglevels.DEBUG_3):
+                typl = base.returnPkgLists(['obsoletes'])
+                ypl.obsoletes = typl.obsoletes
+                ypl.obsoletesTuples = typl.obsoletesTuples
+
             columns = _list_cmd_calc_columns(base, ypl)
             if len(ypl.updates) > 0:
                 base.listPkgs(ypl.updates, '', outputType='list',
                               columns=columns)
                 result = 100
+            if len(ypl.obsoletes) > 0: # This only happens in verbose mode
+                rop = [0, '']
+                print _('Obsoleting Packages')
+                # The tuple is (newPkg, oldPkg) ... so sort by new
+                for obtup in sorted(ypl.obsoletesTuples,
+                                    key=operator.itemgetter(0)):
+                    base.updatesObsoletesList(obtup, 'obsoletes',
+                                              columns=columns)
+                result = 100
         except yum.Errors.YumBaseError, e:
             return 1, [str(e)]
         else:


More information about the Yum-commits mailing list