aboutsummaryrefslogtreecommitdiff
path: root/mesalib/src/mapi/glapi/gen/gl_enums.py
diff options
context:
space:
mode:
Diffstat (limited to 'mesalib/src/mapi/glapi/gen/gl_enums.py')
-rwxr-xr-xmesalib/src/mapi/glapi/gen/gl_enums.py34
1 files changed, 18 insertions, 16 deletions
diff --git a/mesalib/src/mapi/glapi/gen/gl_enums.py b/mesalib/src/mapi/glapi/gen/gl_enums.py
index 7c55ee443..0d393e3be 100755
--- a/mesalib/src/mapi/glapi/gen/gl_enums.py
+++ b/mesalib/src/mapi/glapi/gen/gl_enums.py
@@ -1,8 +1,8 @@
#!/usr/bin/env python
# -*- 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 <zack@kde.org>
+import argparse
+
import license
import gl_XML
import sys, getopt
@@ -201,21 +203,21 @@ _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);
+def main():
+ args = _parser()
+ api_list = [gl_XML.parse_GL_API(args.input_file)]
printer = PrintGlEnums()
- printer.Print( api_list )
+ printer.Print(api_list)
+
+
+if __name__ == '__main__':
+ main()