[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
James Bowes
jbowes at linux.duke.edu
Mon Nov 27 00:00:13 UTC 2006
- Previous message: [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
- Next message: [yum-cvs] yum/yum __init__.py,1.263,1.264
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /home/groups/yum/cvs/yum
In directory login1.linux.duke.edu:/tmp/cvs-serv16715
Modified Files:
Tag: yum-3_0_X
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.241.2.3
retrieving revision 1.241.2.4
diff -u -r1.241.2.3 -r1.241.2.4
--- cli.py 16 Nov 2006 02:22:26 -0000 1.241.2.3
+++ cli.py 27 Nov 2006 00:00:10 -0000 1.241.2.4
@@ -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.33.2.1
diff -u -r1.33 -r1.33.2.1
--- shell.py 3 Oct 2006 05:48:48 -0000 1.33
+++ shell.py 27 Nov 2006 00:00:10 -0000 1.33.2.1
@@ -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.1.2.1
diff -u -r1.1 -r1.1.2.1
--- yumcommands.py 26 Sep 2006 13:24:58 -0000 1.1
+++ yumcommands.py 27 Nov 2006 00:00:10 -0000 1.1.2.1
@@ -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.100.2.1
retrieving revision 1.100.2.2
diff -u -r1.100.2.1 -r1.100.2.2
--- yummain.py 24 Nov 2006 18:14:25 -0000 1.100.2.1
+++ yummain.py 27 Nov 2006 00:00:10 -0000 1.100.2.2
@@ -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 cli.py, 1.244, 1.245 shell.py, 1.33, 1.34 yumcommands.py, 1.1, 1.2 yummain.py, 1.101, 1.102
- Next message: [yum-cvs] yum/yum __init__.py,1.263,1.264
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Yum-cvs-commits
mailing list