[Mesa-dev] [RFC 02/13] glapi/gen: use main function in gl_marshal_h.py

Dylan Baker dylan at pnwbakers.com
Fri Nov 23 22:27:51 UTC 2018


It's more idiomatic python.
---
 src/mapi/glapi/gen/gl_marshal_h.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/mapi/glapi/gen/gl_marshal_h.py b/src/mapi/glapi/gen/gl_marshal_h.py
index d870bba5ed6..619754e05c6 100644
--- a/src/mapi/glapi/gen/gl_marshal_h.py
+++ b/src/mapi/glapi/gen/gl_marshal_h.py
@@ -66,7 +66,7 @@ class PrintCode(gl_XML.gl_print_base):
 
 
 
-if __name__ == '__main__':
+def main():
     parser = argparse.ArgumentParser()
     parser.add_argument('-f', '--filename', metavar='input_file_name', default='gl_API.xml')
     args = parser.parse_args()
@@ -75,3 +75,7 @@ if __name__ == '__main__':
 
     api = gl_XML.parse_GL_API(args.filename, marshal_XML.marshal_item_factory())
     printer.Print(api)
+
+
+if __name__ == '__main__':
+    main()
-- 
2.19.2



More information about the mesa-dev mailing list