summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDylan Baker <[email protected]>2015-02-09 14:18:30 -0800
committerMatt Turner <[email protected]>2015-05-22 11:31:27 -0700
commitfd5f1dd6c72e34a8f0522c4706cd5eec624e80cf (patch)
treea9a831ebca157246cdfa02c71f5d905d261848a1 /src
parente51530ba1665af7120be852653bbff930fa1ca33 (diff)
glapi: gl_enums.py: use argparse instead of getopt.
Signed-off-by: Dylan Baker <[email protected]> Acked-by: Matt Turner <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mapi/glapi/gen/gl_enums.py30
1 files changed, 14 insertions, 16 deletions
diff --git a/src/mapi/glapi/gen/gl_enums.py b/src/mapi/glapi/gen/gl_enums.py
index f45782df85f..927a68b3e05 100644
--- a/src/mapi/glapi/gen/gl_enums.py
+++ b/src/mapi/glapi/gen/gl_enums.py
@@ -1,8 +1,8 @@
#!/usr/bin/python2
# -*- Mode: Python; py-indent-offset: 8 -*-
-# (C) Copyright Zack Rusin 2005
-# All Rights Reserved.
+# (C) Copyright Zack Rusin 2005. All Rights Reserved.
+# Copyright (C) 2015 Intel Corporation
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
@@ -26,6 +26,8 @@
# Authors:
# Zack Rusin <[email protected]>
+import argparse
+
import license
import gl_XML
import sys, getopt
@@ -201,21 +203,17 @@ _mesa_lookup_prim_by_nr(GLuint nr)
enum.append( [name, priority] )
-def show_usage():
- print "Usage: %s [-f input_file_name]" % sys.argv[0]
- sys.exit(1)
+def _parser():
+ parser = argparse.ArgumentParser()
+ parser.add_argument('-f', '--input_file',
+ required=True,
+ help="Choose an xml file to parse.")
+ return parser.parse_args()
-if __name__ == '__main__':
- try:
- (args, trail) = getopt.getopt(sys.argv[1:], "f:")
- except Exception,e:
- show_usage()
- api_list = []
- for (arg,val) in args:
- if arg == "-f":
- api = gl_XML.parse_GL_API( val )
- api_list.append(api);
+if __name__ == '__main__':
+ args = _parser()
+ api_list = [gl_XML.parse_GL_API(args.input_file)]
printer = PrintGlEnums()
- printer.Print( api_list )
+ printer.Print(api_list)