From 50d489f38e18577cb7e75605515d4b8d567aaa52 Mon Sep 17 00:00:00 2001 From: Sol Jerome Date: Mon, 4 Apr 2011 08:59:54 -0500 Subject: tools: PY3K + PEP8 fixes Signed-off-by: Sol Jerome --- tools/yum-listpkgs-xml.py | 51 ++++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 25 deletions(-) (limited to 'tools/yum-listpkgs-xml.py') diff --git a/tools/yum-listpkgs-xml.py b/tools/yum-listpkgs-xml.py index c324d0889..60d440ddf 100644 --- a/tools/yum-listpkgs-xml.py +++ b/tools/yum-listpkgs-xml.py @@ -3,40 +3,41 @@ import sys sys.path.append('/usr/bin/') sys.path.append('/usr/share/yum-cli') -import yum import yummain + def mySimpleList(self, pkg): - print "" % (pkg.name, pkg.printVer()) - + print("" % (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." -- cgit v1.2.3-1-g7c22