[yum-commits] Branch 'yum-3_2_X' - 3 commits - cli.py output.py yumcommands.py

James Antill james at osuosl.org
Thu Jan 8 19:04:10 UTC 2009


 cli.py         |    2 --
 output.py      |   10 +++-------
 yumcommands.py |   33 +++++++++++++++++----------------
 3 files changed, 20 insertions(+), 25 deletions(-)

New commits:
commit a6d04cc6eb2c5b8dc231f594b94a9e7990e42beb
Merge: cc01749... d7088b8...
Author: James Antill <james at and.org>
Date:   Thu Jan 8 14:03:44 2009 -0500

    Merge commit 'd7088b8836c91d11301c53af8ed912c4bfbad4c7' into yum-3_2_X
    
    * commit 'd7088b8836c91d11301c53af8ed912c4bfbad4c7':
      Only output the "setting up X command" once, per. yb ... rm extra install msg
      Can't assign a property, and keep the property behaviuor, so don't do that

commit d7088b8836c91d11301c53af8ed912c4bfbad4c7
Author: James Antill <james at and.org>
Date:   Thu Dec 11 12:35:38 2008 -0500

    Only output the "setting up X command" once, per. yb ... rm extra install msg

diff --git a/cli.py b/cli.py
index e3a4161..8616cda 100644
--- a/cli.py
+++ b/cli.py
@@ -568,8 +568,6 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
         toBeInstalled = {} # keyed on name
         passToUpdate = [] # list of pkgtups to pass along to updatecheck
 
-        self.verbose_logger.log(yum.logginglevels.INFO_2,
-            _('Parsing package install arguments'))
         for arg in userlist:
             if os.path.exists(arg) and arg.endswith('.rpm'): # this is hurky, deal w/it
                 val, msglist = self.localInstall(filelist=[arg])
diff --git a/yumcommands.py b/yumcommands.py
index 3783292..eb1ab5d 100644
--- a/yumcommands.py
+++ b/yumcommands.py
@@ -123,6 +123,14 @@ def checkShellArg(base, basecmd, extcmds):
 
 class YumCommand:
         
+    def __init__(self):
+        self.done_command_once = False
+
+    def doneCommand(self, base, msg, *args):
+        if not self.done_command_once:
+            base.verbose_logger.log(logginglevels.INFO_2, msg, *args)
+        self.done_command_once = True
+
     def getNames(self):
         return []
 
@@ -169,8 +177,7 @@ class InstallCommand(YumCommand):
         checkPackageArg(base, basecmd, extcmds)
 
     def doCommand(self, base, basecmd, extcmds):
-        base.verbose_logger.log(logginglevels.INFO_2, 
-                _("Setting up Install Process"))
+        self.doneCommand(base, _("Setting up Install Process"))
         try:
             return base.installPkgs(extcmds)
         except yum.Errors.YumBaseError, e:
@@ -191,8 +198,7 @@ class UpdateCommand(YumCommand):
         checkGPGKey(base)
 
     def doCommand(self, base, basecmd, extcmds):
-        base.verbose_logger.log(logginglevels.INFO_2, 
-                _("Setting up Update Process"))
+        self.doneCommand(base, _("Setting up Update Process"))
         try:
             return base.updatePkgs(extcmds)
         except yum.Errors.YumBaseError, e:
@@ -344,8 +350,7 @@ class EraseCommand(YumCommand):
         checkPackageArg(base, basecmd, extcmds)
 
     def doCommand(self, base, basecmd, extcmds):
-        base.verbose_logger.log(logginglevels.INFO_2, 
-                _("Setting up Remove Process"))
+        self.doneCommand(base, _("Setting up Remove Process"))
         try:
             return base.erasePkgs(extcmds)
         except yum.Errors.YumBaseError, e:
@@ -359,8 +364,7 @@ class EraseCommand(YumCommand):
 
 class GroupCommand(YumCommand):
     def doCommand(self, base, basecmd, extcmds):
-        base.verbose_logger.log(logginglevels.INFO_2, 
-                _("Setting up Group Process"))
+        self.doneCommand(base, _("Setting up Group Process"))
 
         base.doRepoSetup(dosack=0)
         try:
@@ -622,8 +626,7 @@ class UpgradeCommand(YumCommand):
 
     def doCommand(self, base, basecmd, extcmds):
         base.conf.obsoletes = 1
-        base.verbose_logger.log(logginglevels.INFO_2, 
-                _("Setting up Upgrade Process"))
+        self.doneCommand(base, _("Setting up Upgrade Process"))
         try:
             return base.updatePkgs(extcmds)
         except yum.Errors.YumBaseError, e:
@@ -645,8 +648,7 @@ class LocalInstallCommand(YumCommand):
         checkPackageArg(base, basecmd, extcmds)
         
     def doCommand(self, base, basecmd, extcmds):
-        base.verbose_logger.log(logginglevels.INFO_2,
-                                _("Setting up Local Package Process"))
+        self.doneCommand(base, _("Setting up Local Package Process"))
 
         updateonly = basecmd == 'localupdate'
         try:
@@ -688,7 +690,7 @@ class ShellCommand(YumCommand):
         checkShellArg(base, basecmd, extcmds)
 
     def doCommand(self, base, basecmd, extcmds):
-        base.verbose_logger.log(logginglevels.INFO_2, _('Setting up Yum Shell'))
+        self.doneCommand(base, _('Setting up Yum Shell'))
         try:
             return base.doShell()
         except yum.Errors.YumBaseError, e:
@@ -712,7 +714,7 @@ class DepListCommand(YumCommand):
         checkPackageArg(base, basecmd, extcmds)
 
     def doCommand(self, base, basecmd, extcmds):
-       base.verbose_logger.log(logginglevels.INFO_2, _("Finding dependencies: "))
+       self.doneCommand(base, _("Finding dependencies: "))
        try:
           return base.deplist(extcmds)
        except yum.Errors.YumBaseError, e:
@@ -973,8 +975,7 @@ class ReInstallCommand(YumCommand):
         checkPackageArg(base, basecmd, extcmds)
 
     def doCommand(self, base, basecmd, extcmds):
-        base.verbose_logger.log(logginglevels.INFO_2, 
-                _("Setting up Reinstall Process"))
+        self.doneCommand(base, _("Setting up Reinstall Process"))
         oldcount = len(base.tsInfo)
         try:
             for item in extcmds:
commit 657f13bdae0f80b88ba97370a9633474312f83b0
Author: James Antill <james at and.org>
Date:   Tue Dec 9 10:47:34 2008 -0500

    Can't assign a property, and keep the property behaviuor, so don't do that

diff --git a/output.py b/output.py
index 3416459..885babc 100755
--- a/output.py
+++ b/output.py
@@ -75,7 +75,7 @@ class YumTerm:
     __enabled = True
 
     if hasattr(urlgrabber.progress, 'terminal_width_cached'):
-        __auto_columns = property(lambda self: _term_width())
+        columns = property(lambda self: _term_width())
 
     __cap_names = {
         'underline' : 'smul',
@@ -143,9 +143,7 @@ class YumTerm:
             return
 
         self.__enabled = True
-        if hasattr(urlgrabber.progress, 'terminal_width_cached'):
-            self.columns = self.__auto_columns
-        else:
+        if not hasattr(urlgrabber.progress, 'terminal_width_cached'):
             self.columns = 80
         self.lines = 24
 
@@ -1209,7 +1207,7 @@ class YumCliRPMCallBack(RPMBaseCallback):
     Yum specific callback class for RPM operations.
     """
 
-    _width = property(lambda x: _term_width())
+    width = property(lambda x: _term_width())
 
     def __init__(self):
         RPMBaseCallback.__init__(self)
@@ -1221,8 +1219,6 @@ class YumCliRPMCallBack(RPMBaseCallback):
         self.mark = "#"
         self.marks = 22
         
-        self.width = self._width
-        
     def event(self, package, action, te_current, te_total, ts_current, ts_total):
         # this is where a progress bar would be called
         process = self.action[action]


More information about the Yum-commits mailing list