Keep functions, but move them into the if main section
This commit is contained in:
parent
c057593be6
commit
90de6d97a5
@ -26,6 +26,20 @@ def create_yumobj(yumconf):
|
||||
|
||||
def main():
|
||||
# This is used for testing the module
|
||||
(opts, args) = get_arguments()
|
||||
try:
|
||||
compsobj = yum.comps.Comps()
|
||||
compsobj.add(opts.comps)
|
||||
|
||||
print get_packagelist(compsobj)
|
||||
|
||||
except IOError:
|
||||
print >> sys.stderr, "gather.py: No such file:\'%s\'" % opts.comps
|
||||
sys.exit(1)
|
||||
|
||||
if __name__ == '__main__':
|
||||
def get_arguments():
|
||||
# hack job for now, I'm sure this could be better for our uses
|
||||
usage = "usage: %s [options]" % sys.argv[0]
|
||||
parser = OptionParser(usage=usage)
|
||||
parser.add_option("--destdir", default=".", dest="destdir",
|
||||
@ -34,22 +48,18 @@ def main():
|
||||
help='comps file to use')
|
||||
parser.add_option("--yumconf", default="yum.conf", dest="yumconf",
|
||||
help='yum config file to use')
|
||||
|
||||
|
||||
(opts, args) = parser.parse_args()
|
||||
#if len(opts) < 1:
|
||||
# parser.print_help()
|
||||
# sys.exit(0)
|
||||
return (opts, args)
|
||||
|
||||
|
||||
try:
|
||||
compsobj = yum.comps.Comps()
|
||||
compsobj.add(opts.comps)
|
||||
|
||||
def get_packagelist(myComps):
|
||||
# Get the list of packages from the comps file
|
||||
pkglist = []
|
||||
for group in compsobj.groups:
|
||||
for group in myComps.groups:
|
||||
pkglist += group.packages
|
||||
print pkglist
|
||||
|
||||
except IOError:
|
||||
print >> sys.stderr, "gather.py: No such file:\'%s\'" % opts.comps
|
||||
sys.exit(1)
|
||||
|
||||
if __name__ == '__main__':
|
||||
return pkglist
|
||||
main()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user