diff options
author | Jack Neely <jjneely@ncsu.edu> | 2011-06-10 13:29:23 -0400 |
---|---|---|
committer | Jack Neely <jjneely@ncsu.edu> | 2011-06-10 13:29:23 -0400 |
commit | 90c85147bacea14771abf8faa1fc5f185418d14b (patch) | |
tree | b10e06fc80ed714f5376b169e32b8953479211f1 /tools/yum-listpkgs-xml.py | |
parent | 4f3da4543ec4e8c3c4776ae2ee3611e47ce78525 (diff) | |
parent | ce6a228d33ace4136dc2b5388c64795dfbd26ffb (diff) | |
download | bcfg2-90c85147bacea14771abf8faa1fc5f185418d14b.tar.gz bcfg2-90c85147bacea14771abf8faa1fc5f185418d14b.tar.bz2 bcfg2-90c85147bacea14771abf8faa1fc5f185418d14b.zip |
Merge branch 'master' of github.com:solj/bcfg2
Diffstat (limited to 'tools/yum-listpkgs-xml.py')
-rw-r--r-- | tools/yum-listpkgs-xml.py | 55 |
1 files changed, 28 insertions, 27 deletions
diff --git a/tools/yum-listpkgs-xml.py b/tools/yum-listpkgs-xml.py index c324d0889..2df5abbcd 100644 --- a/tools/yum-listpkgs-xml.py +++ b/tools/yum-listpkgs-xml.py @@ -3,41 +3,42 @@ import sys sys.path.append('/usr/bin/') sys.path.append('/usr/share/yum-cli') -import yum import yummain + def mySimpleList(self, pkg): - print "<Package name='%s' version='%s'/>" % (pkg.name, pkg.printVer()) - + print("<Package name='%s' version='%s'/>" % (pkg.name, pkg.printVer())) + + def myListPkgs(self, lst, description, outputType): - """outputs based on whatever outputType is. Current options: - 'list' - simple pkg list - 'info' - similar to rpm -qi output""" - - if outputType in ['list', 'info']: - thingslisted = 0 - if len(lst) > 0: - thingslisted = 1 - #print '%s' % description - from yum.misc import sortPkgObj - lst.sort(sortPkgObj) - for pkg in lst: - if outputType == 'list': - self.simpleList(pkg) - elif outputType == 'info': - self.infoOutput(pkg) - else: - pass - - if thingslisted == 0: - return 1, ['No Packages to list'] + """outputs based on whatever outputType is. Current options: + 'list' - simple pkg list + 'info' - similar to rpm -qi output""" + + if outputType in ['list', 'info']: + thingslisted = 0 + if len(lst) > 0: + thingslisted = 1 + #print '%s' % description + from yum.misc import sortPkgObj + lst.sort(sortPkgObj) + for pkg in lst: + if outputType == 'list': + self.simpleList(pkg) + elif outputType == 'info': + self.infoOutput(pkg) + else: + pass + + if thingslisted == 0: + return 1, ['No Packages to list'] yummain.cli.output.YumOutput.listPkgs = myListPkgs yummain.cli.output.YumOutput.simpleList = mySimpleList try: - sys.argv = [sys.argv[0],'-d','0','list'] + sys.argv = [sys.argv[0], '-d', '0', 'list'] yummain.main(sys.argv[1:]) -except KeyboardInterrupt, e: - print >> sys.stderr, "\n\nExiting on user cancel." +except KeyboardInterrupt: + print("\n\nExiting on user cancel.", file=sys.stderr) sys.exit(1) |