[yum-cvs] yum shell.py,1.20,1.21

Seth Vidal skvidal at login.linux.duke.edu
Fri Aug 5 05:41:09 UTC 2005


Update of /home/groups/yum/cvs/yum
In directory login:/tmp/cvs-serv17507

Modified Files:
	shell.py 
Log Message:
shell.py: support shell-like quoting of arguments - especially useful for
          group names
docs/yum-shell.8: document the yum shell
docs/yum.8: point to the yum shell docs
docs/Makefile: install the yum-shell man page.



Index: shell.py
===================================================================
RCS file: /home/groups/yum/cvs/yum/shell.py,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- shell.py	30 Jun 2005 05:58:00 -0000	1.20
+++ shell.py	5 Aug 2005 05:41:07 -0000	1.21
@@ -17,18 +17,11 @@
 import os.path
 import cmd
 import string
+import shlex
 
 from yum import Errors
 from yum.constants import *
 
-# TODO: implement setconfig and getconfig - this should only expose a subset
-#       of the configuration options. exposing all of them, especially the lists
-#       would be a pain to parse and handle but the int, string and booleans
-#       should be doable. Config only affects global config settings not
-#       repo configuration.
-#       one of the oft-requested lists will be 'exclude' - this should be its 
-#       own command, probably so we can set excludes. make it a space separated
-#       list
 
 class YumShell(cmd.Cmd):
     def __init__(self, base):
@@ -45,6 +38,7 @@
             'makecache', 'provides', 'quit', 'remove', 'run', 'search',
             'transaction', 'ts', 'update', 'config', 'deplist']
 
+
     def script(self):
         try:
             fd = open(self.file, 'r')
@@ -67,7 +61,7 @@
                 return False
             self.base.cmdstring = line
             self.base.cmdstring = self.base.cmdstring.replace('\n', '')
-            self.base.cmds = self.base.cmdstring.split()
+            self.base.cmds = shlex.split(self.base.cmdstring)
             try:
                 self.base.parseCommands()
             except Errors.YumBaseError:
@@ -159,7 +153,7 @@
         (cmd, args, line) = self.parseline(line)
         # logs
         if cmd in ['debuglevel', 'errorlevel']:
-            opts = args.split()
+            opts = shlex.split(args)
             if not opts:
                 self.base.log(2, '%s: %s' % (cmd, self.base.conf.getConfigOption(cmd)))
             else:
@@ -176,7 +170,7 @@
                     self.base.errorlog.threshold = val
         # bools
         elif cmd in ['gpgcheck', 'obsoletes', 'assumeyes']:
-            opts = args.split()
+            opts = shlex.split(args)
             if not opts:
                 self.base.log(2, '%s: %s' % (cmd, self.base.conf.getConfigOption(cmd)))
             else:
@@ -192,7 +186,7 @@
         
         elif cmd in ['exclude']:
             args = args.replace(',', ' ')
-            opts = args.split()
+            opts = shlex.split(args)
             if not opts:
                 msg = '%s: ' % cmd
                 msg = msg + string.join(self.base.conf.getConfigOption(cmd))
@@ -227,7 +221,7 @@
                     self.base.log(2, '%-20.20s %-40.40s  disabled' % (repo, repo.name))
         
         elif cmd == 'enable':
-            repos = args.split()
+            repos = shlex.split(args)
             for repo in repos:
                 try:
                     changed = self.base.repos.enableRepo(repo)
@@ -249,7 +243,7 @@
                         del self.base.up
             
         elif cmd == 'disable':
-            repos = args.split()
+            repos = shlex.split(args)
             for repo in repos:
                 try:
                     self.base.repos.disableRepo(repo)




More information about the Yum-cvs-commits mailing list