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

skvidal at osuosl.org skvidal at osuosl.org
Tue Aug 4 18:23:17 UTC 2009


 yumcommands.py |  133 +--------------------------------------------------------
 1 file changed, 4 insertions(+), 129 deletions(-)

New commits:
commit 64deb9f90bfd07fbf741c00ff44bb3e90f515c3f
Author: Seth Vidal <skvidal at fedoraproject.org>
Date:   Tue Aug 4 14:17:37 2009 -0400

    reverting 'help recent'.

diff --git a/yumcommands.py b/yumcommands.py
index 1227484..edaddfd 100644
--- a/yumcommands.py
+++ b/yumcommands.py
@@ -28,7 +28,7 @@ import operator
 import locale
 import fnmatch
 import time
-from yum.i18n import utf8_width, utf8_width_fill, utf8_text_fill, to_unicode
+from yum.i18n import utf8_width, utf8_width_fill, to_unicode
 
 def checkRootUID(base):
     """
@@ -120,10 +120,7 @@ def checkShellArg(base, basecmd, extcmds):
         raise cli.CliError
 
 class YumCommand:
-
-    # Epoch seconds. Use: date -d '2006-09-26 13:24:58 +0000' +'%s' ... etc.
-    created = 0
-
+        
     def __init__(self):
         self.done_command_once = False
 
@@ -163,9 +160,6 @@ class YumCommand:
         return True
         
 class InstallCommand(YumCommand):
-
-    created = 1159277098
-
     def getNames(self):
         return ['install']
 
@@ -188,9 +182,6 @@ class InstallCommand(YumCommand):
             return 1, [str(e)]
 
 class UpdateCommand(YumCommand):
-
-    created = 1159277098
-
     def getNames(self):
         return ['update']
 
@@ -243,9 +234,6 @@ def _list_cmd_calc_columns(base, ypl):
     return (-columns[0], -columns[1], -columns[2])
 
 class InfoCommand(YumCommand):
-
-    created = 1159277098
-
     def getNames(self):
         return ['info']
 
@@ -352,9 +340,6 @@ class InfoCommand(YumCommand):
         return True
 
 class ListCommand(InfoCommand):
-
-    created = 1159277098
-
     def getNames(self):
         return ['list']
 
@@ -363,9 +348,7 @@ class ListCommand(InfoCommand):
 
 
 class EraseCommand(YumCommand):
-
-    created = 1159277098
-
+        
     def getNames(self):
         return ['erase', 'remove']
 
@@ -393,9 +376,6 @@ class EraseCommand(YumCommand):
         return True
 
 class GroupCommand(YumCommand):
-
-    created = 1159277098
-
     def doCommand(self, base, basecmd, extcmds):
         self.doneCommand(base, _("Setting up Group Process"))
 
@@ -499,8 +479,6 @@ class GroupInfoCommand(GroupCommand):
 
 class MakeCacheCommand(YumCommand):
 
-    created = 1159277098
-
     def getNames(self):
         return ['makecache']
 
@@ -542,9 +520,7 @@ class MakeCacheCommand(YumCommand):
         return False
 
 class CleanCommand(YumCommand):
-
-    created = 1159277098
-
+    
     def getNames(self):
         return ['clean']
 
@@ -565,9 +541,6 @@ class CleanCommand(YumCommand):
         return False
 
 class ProvidesCommand(YumCommand):
-
-    created = 1159277098
-
     def getNames(self):
         return ['provides', 'whatprovides']
 
@@ -588,9 +561,6 @@ class ProvidesCommand(YumCommand):
             return 1, [str(e)]
 
 class CheckUpdateCommand(YumCommand):
-
-    created = 1159277098
-
     def getNames(self):
         return ['check-update']
 
@@ -640,9 +610,6 @@ class CheckUpdateCommand(YumCommand):
             return result, []
 
 class SearchCommand(YumCommand):
-
-    created = 1159277098
-
     def getNames(self):
         return ['search']
 
@@ -666,9 +633,6 @@ class SearchCommand(YumCommand):
         return False
 
 class UpgradeCommand(YumCommand):
-
-    created = 1159277098
-
     def getNames(self):
         return ['upgrade']
 
@@ -691,9 +655,6 @@ class UpgradeCommand(YumCommand):
             return 1, [str(e)]
 
 class LocalInstallCommand(YumCommand):
-
-    created = 1159277098
-
     def getNames(self):
         return ['localinstall', 'localupdate']
 
@@ -721,9 +682,6 @@ class LocalInstallCommand(YumCommand):
         return False
 
 class ResolveDepCommand(YumCommand):
-
-    created = 1159277098
-
     def getNames(self):
         return ['resolvedep']
 
@@ -741,9 +699,6 @@ class ResolveDepCommand(YumCommand):
             return 1, [str(e)]
 
 class ShellCommand(YumCommand):
-
-    created = 1159277098
-
     def getNames(self):
         return ['shell']
 
@@ -768,9 +723,6 @@ class ShellCommand(YumCommand):
 
 
 class DepListCommand(YumCommand):
-
-    created = 1159277098
-
     def getNames(self):
         return ['deplist']
 
@@ -792,8 +744,6 @@ class DepListCommand(YumCommand):
 
 
 class RepoListCommand(YumCommand):
-
-    created = 1178147972
     
     def getNames(self):
         return ('repolist',)
@@ -982,24 +932,6 @@ class RepoListCommand(YumCommand):
 
 class HelpCommand(YumCommand):
 
-    created = 1201218844
-
-    @staticmethod
-    def _key_created(cmd):
-        if hasattr(cmd, 'created'):
-            return cmd.created
-        return 0
-    @staticmethod
-    def _key_summary(cmd):
-        if hasattr(cmd, 'getSummary'):
-            return cmd.getSummary()
-        return ''
-    @staticmethod
-    def _key_usage(cmd):
-        if hasattr(cmd, 'getUsage'):
-            return cmd.getUsage()
-        return ''
-
     def getNames(self):
         return ['help']
 
@@ -1013,10 +945,6 @@ class HelpCommand(YumCommand):
         if len(extcmds) == 0:
             base.usage()
             raise cli.CliError
-        elif len(extcmds) in (1, 2) and extcmds[0] == 'recent':
-            pass
-        elif len(extcmds) == 2 and extcmds[0] in ('cmd', 'command'):
-            pass
         elif len(extcmds) > 1 or extcmds[0] not in base.yum_cli_commands:
             base.usage()
             raise cli.CliError
@@ -1058,50 +986,6 @@ class HelpCommand(YumCommand):
         return help_output
 
     def doCommand(self, base, basecmd, extcmds):
-        if extcmds[0] == 'recent':
-            last = "4"
-            if len(extcmds) > 1:
-                last = extcmds[1]
-            last = int(last)
-            if last < 1:
-                last = 1
-
-            cols = base.term.columns
-            print base.fmtSection("%d most recent command(s)" % (last,))
-            colname = _("Command")
-            maxname = utf8_width(colname)
-            cur = 0
-            for cmd in sorted(base.yum_cli_commands.values(), reverse=True,
-                              key=self._key_created):
-                if maxname < len(cmd.getNames()[0]):
-                    maxname = len(cmd.getNames()[0])
-                cur += 1
-                if cur >= last:
-                    break
-            print "%s %s %s" % (utf8_width_fill(colname, maxname),
-                                utf8_width_fill(_("Created"), 10, 10),
-                                _("Summary"))
-            cur = 0
-            for cmd in sorted(base.yum_cli_commands.values(), reverse=True,
-                              key=self._key_created):
-                name = cmd.getNames()[0]
-                created = self._key_created(cmd)
-                if not created:
-                    created = 'N/A' # Not i18n, because it should be fixed
-                else:
-                    created = time.strftime("%Y-%m-%d", time.localtime(created))
-                summary = self._key_summary(cmd)
-                text = "%s %-10s " % (utf8_width_fill(name, maxname), created)
-                print utf8_text_fill(summary, width=cols, initial_indent=text,
-                                     subsequent_indent=' ' * utf8_width(text))
-
-                cur += 1
-                if cur >= last:
-                    break
-            return 0, []
-
-        if extcmds[0] in ('cmd', 'command'):
-            extcmds = extcmds[1:]
         if base.yum_cli_commands.has_key(extcmds[0]):
             command = base.yum_cli_commands[extcmds[0]]
             base.verbose_logger.log(logginglevels.INFO_2,
@@ -1112,9 +996,6 @@ class HelpCommand(YumCommand):
         return False
 
 class ReInstallCommand(YumCommand):
-
-    created = 1202159716
-
     def getNames(self):
         return ['reinstall']
 
@@ -1141,9 +1022,6 @@ class ReInstallCommand(YumCommand):
         return False
         
 class DowngradeCommand(YumCommand):
-
-    created = 1237904399
-
     def getNames(self):
         return ['downgrade']
 
@@ -1170,9 +1048,6 @@ class DowngradeCommand(YumCommand):
         
 
 class VersionCommand(YumCommand):
-
-    created = 1242925190
-
     def getNames(self):
         return ['version']
 


More information about the Yum-commits mailing list