[yum-cvs] yum cli.py, 1.244, 1.245 shell.py, 1.33, 1.34 yumcommands.py, 1.1, 1.2 yummain.py, 1.101, 1.102
James Bowes
jbowes at linux.duke.edu
Sun Nov 26 23:59:47 UTC 2006
- Previous message: [yum-cvs] yum/yum plugins.py,1.34,1.34.2.1
- Next message: [yum-cvs] yum cli.py, 1.241.2.3, 1.241.2.4 shell.py, 1.33, 1.33.2.1 yumcommands.py, 1.1, 1.1.2.1 yummain.py, 1.100.2.1, 1.100.2.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/groups/yum/cvs/yum
In directory login1.linux.duke.edu:/tmp/cvs-serv16674
Modified Files:
cli.py shell.py yumcommands.py yummain.py
Log Message:
Implement the ShellCommand code
Index: cli.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/cli.py,v
retrieving revision 1.244
retrieving revision 1.245
diff -u -r1.244 -r1.245
--- cli.py 16 Nov 2006 02:22:13 -0000 1.244
+++ cli.py 26 Nov 2006 23:59:44 -0000 1.245
@@ -55,7 +55,6 @@
# handle sigquit early on
signal.signal(signal.SIGQUIT, sigquit)
yum.YumBase.__init__(self)
- self.in_shell = False
logging.basicConfig()
self.logger = logging.getLogger("yum.cli")
self.verbose_logger = logging.getLogger("yum.verbose.cli")
@@ -326,16 +325,12 @@
def doShell(self):
"""do a shell-like interface for yum commands"""
- self.verbose_logger.log(logginglevels.INFO_2, 'Setting up Yum Shell')
- self.in_shell = True
- self.doTsSetup()
self.doRpmDBSetup()
+ yumshell = shell.YumShell(base=self)
if len(self.extcmds) == 0:
- yumshell = shell.YumShell(base=self)
yumshell.cmdloop()
else:
- yumshell = shell.YumShell(base=self)
yumshell.script()
return yumshell.result, yumshell.resultmsgs
@@ -1087,15 +1082,12 @@
return False
def usage(self):
- '''Print out command line usage
- '''
- if not self.in_shell:
- print
- self.optparser.print_help()
- else:
- print
- self.optparser.print_usage()
-
+ ''' Print out command line usage '''
+ print self.optparser.print_help()
+
+ def shellUsage(self):
+ ''' Print out the shell usage '''
+ print self.optparser.print_usage()
Index: shell.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/shell.py,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- shell.py 3 Oct 2006 05:48:48 -0000 1.33
+++ shell.py 26 Nov 2006 23:59:45 -0000 1.34
@@ -77,6 +77,8 @@
if cmd not in self.commandlist:
self.do_help('')
return False
+ if cmd == 'shell':
+ return
self.base.cmdstring = line
self.base.cmdstring = self.base.cmdstring.replace('\n', '')
self.base.cmds = self._shlex_split(self.base.cmdstring)
@@ -126,7 +128,7 @@
""" % arg
else:
- self.base.usage()
+ self.base.shellUsage()
self.verbose_logger.info(msg)
Index: yumcommands.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yumcommands.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- yumcommands.py 26 Sep 2006 13:24:58 -0000 1.1
+++ yumcommands.py 26 Nov 2006 23:59:45 -0000 1.2
@@ -391,6 +391,14 @@
def doCheck(self, base, basecmd, extcmds):
checkShellArg(base, basecmd, extcmds)
+ def doCommand(self, base, basecmd, extcmds):
+ base.verbose_logger.log(logginglevels.INFO_2, 'Setting up Yum Shell')
+ try:
+ return base.doShell()
+ except yum.Errors.YumBaseError, e:
+ return 1, [str(e)]
+
+
class DepListCommand(YumCommand):
def getNames(self):
return ['deplist']
Index: yummain.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/yummain.py,v
retrieving revision 1.101
retrieving revision 1.102
diff -u -r1.101 -r1.102
--- yummain.py 23 Nov 2006 02:28:55 -0000 1.101
+++ yummain.py 26 Nov 2006 23:59:45 -0000 1.102
@@ -92,13 +92,8 @@
logger.critical('%s', e.msg)
sys.exit(200)
- # build up an idea of what we're supposed to do
- if base.basecmd == 'shell':
- do = base.doShell
- else:
- do = base.doCommands
try:
- result, resultmsgs = do()
+ result, resultmsgs = base.doCommands()
except plugins.PluginYumExit, e:
exPluginExit(e)
except Errors.YumBaseError, e:
- Previous message: [yum-cvs] yum/yum plugins.py,1.34,1.34.2.1
- Next message: [yum-cvs] yum cli.py, 1.241.2.3, 1.241.2.4 shell.py, 1.33, 1.33.2.1 yumcommands.py, 1.1, 1.1.2.1 yummain.py, 1.100.2.1, 1.100.2.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Yum-cvs-commits
mailing list