diff options
author | Dylan Baker <baker.dylan.c@gmail.com> | 2015-05-20 11:49:10 -0700 |
---|---|---|
committer | Matt Turner <mattst88@gmail.com> | 2015-05-22 11:31:28 -0700 |
commit | 79c4e595bce563d6075fed176c2256bf2e7e99a5 (patch) | |
tree | 0baf1034c9df778597852aac3d98d171ac795f95 /src/mapi/glapi | |
parent | 9097a4a103f2f7abf5af3e1056467c21051405ca (diff) | |
download | external_mesa3d-79c4e595bce563d6075fed176c2256bf2e7e99a5.zip external_mesa3d-79c4e595bce563d6075fed176c2256bf2e7e99a5.tar.gz external_mesa3d-79c4e595bce563d6075fed176c2256bf2e7e99a5.tar.bz2 |
glapi: gl_genexec.py: use argparse instead of getopt
Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Acked-by: Matt Turner <mattst88@gmail.com>
Diffstat (limited to 'src/mapi/glapi')
-rw-r--r-- | src/mapi/glapi/gen/gl_genexec.py | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/src/mapi/glapi/gen/gl_genexec.py b/src/mapi/glapi/gen/gl_genexec.py index 4e76fe3..dbaafa7 100644 --- a/src/mapi/glapi/gen/gl_genexec.py +++ b/src/mapi/glapi/gen/gl_genexec.py @@ -25,10 +25,11 @@ # _mesa_initialize_exec_table(). It is responsible for populating all # entries in the "exec" dispatch table that aren't dynamic. +import argparse import collections import license import gl_XML -import sys, getopt +import sys exec_flavor_map = { @@ -207,24 +208,18 @@ class PrintCode(gl_XML.gl_print_base): print ' }' -def show_usage(): - print "Usage: %s [-f input_file_name]" % sys.argv[0] - sys.exit(1) +def _parser(): + """Parse arguments and return namespace.""" + parser = argparse.ArgumentParser() + parser.add_argument('-f', + dest='filename', + default='gl_and_es_API.xml', + help='an xml file describing an API') + return parser.parse_args() if __name__ == '__main__': - file_name = "gl_and_es_API.xml" - - try: - (args, trail) = getopt.getopt(sys.argv[1:], "m:f:") - except Exception,e: - show_usage() - - for (arg,val) in args: - if arg == "-f": - file_name = val - + args = _parser() printer = PrintCode() - - api = gl_XML.parse_GL_API(file_name) + api = gl_XML.parse_GL_API(args.filename) printer.Print(api) |