diff options
author | Zac Medico <zmedico@gentoo.org> | 2006-07-10 19:12:45 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2006-07-10 19:12:45 +0000 |
commit | 69afca2d3bbbfb32376d7c8926389b332af94fc7 (patch) | |
tree | 441d0c7cdd048642a68c0333ea68a22d6b2ad92f | |
parent | c9054709dac49dc75054e600841d4803f661bbcb (diff) | |
download | portage-69afca2d3bbbfb32376d7c8926389b332af94fc7.tar.gz portage-69afca2d3bbbfb32376d7c8926389b332af94fc7.tar.bz2 portage-69afca2d3bbbfb32376d7c8926389b332af94fc7.zip |
Move code out of global scope.
svn path=/main/trunk/; revision=3832
-rwxr-xr-x | bin/emaint | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/bin/emaint b/bin/emaint index 4bf27e6ae..fc1548527 100755 --- a/bin/emaint +++ b/bin/emaint @@ -2,7 +2,6 @@ import sys sys.path.insert(0, "/usr/lib/portage/pym") -from copy import copy from optparse import OptionParser, OptionValueError import re @@ -104,16 +103,16 @@ class VdbKeyHandler(object): return errors -# this sucks, should track this in a different manner. -#modules = {"world" : WorldHandler, -# "vdbkeys": VdbKeyHandler} -modules = {"world" : WorldHandler} +def emaint_main(myargv): -module_names = modules.keys() -module_names.sort() -module_names.insert(0, "all") + # TODO: Create a system that allows external modules to be added without + # the need for hard coding. + modules = {"world" : WorldHandler} + + module_names = modules.keys() + module_names.sort() + module_names.insert(0, "all") -if __name__ == "__main__": def exclusive(option, *args, **kw): var = kw.get("var", None) if var is None: @@ -138,7 +137,7 @@ if __name__ == "__main__": parser.action = None - (options, args) = parser.parse_args() + (options, args) = parser.parse_args(args=myargv) if len(args) != 1: parser.error("Incorrect number of arguments") if args[0] not in module_names: @@ -174,3 +173,6 @@ if __name__ == "__main__": print "\n" print "Finished" + +if __name__ == "__main__": + emaint_main(sys.argv[1:]) |