From: Paul Berry Date: Wed, 10 Oct 2012 18:01:35 +0000 (-0700) Subject: glapi: use new-style Python classes. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7dc052b12bb8341a57151e1f3cefb8f9d15d5192;p=mesa.git glapi: use new-style Python classes. An unfortunate quirk of Python 2 is that there are two types of classes: "classic" classes (which are backward compatible with some unfortunate design decisions made early in Python's history), and "new-style" classes. Classic classes have a number of limitations (for example they don't support super()) and are unavailable in Python 3. There's really no reason to use classic classes, except in unmaintained legacy code. For more information see http://www.python.org/download/releases/2.2.3/descrintro/. This patch upgrades the Python code in src/mapi/glapi/gen to use exclusively new-style classes. Tested-by: Matt Turner Reviewed-by: Ian Romanick --- diff --git a/src/mapi/glapi/gen/glX_XML.py b/src/mapi/glapi/gen/glX_XML.py index 975321a76ab..03a35b740eb 100644 --- a/src/mapi/glapi/gen/glX_XML.py +++ b/src/mapi/glapi/gen/glX_XML.py @@ -543,7 +543,7 @@ class glx_function(gl_XML.gl_function): return not self.ignore and (self.offset != -1) and (self.glx_rop or self.glx_sop or self.glx_vendorpriv or self.vectorequiv or self.client_handcode) -class glx_function_iterator: +class glx_function_iterator(object): """Class to iterate over a list of glXFunctions""" def __init__(self, context): diff --git a/src/mapi/glapi/gen/glX_proto_size.py b/src/mapi/glapi/gen/glX_proto_size.py index 7db816b2c01..fdb355d4d84 100644 --- a/src/mapi/glapi/gen/glX_proto_size.py +++ b/src/mapi/glapi/gen/glX_proto_size.py @@ -30,7 +30,7 @@ import license import sys, getopt, copy, string -class glx_enum_function: +class glx_enum_function(object): def __init__(self, func_name, enum_dict): self.name = func_name self.mode = 1 diff --git a/src/mapi/glapi/gen/gl_XML.py b/src/mapi/glapi/gen/gl_XML.py index ce14a416d5a..f956730f2e0 100644 --- a/src/mapi/glapi/gen/gl_XML.py +++ b/src/mapi/glapi/gen/gl_XML.py @@ -72,7 +72,7 @@ def is_attr_true( element, name ): raise RuntimeError('Invalid value "%s" for boolean "%s".' % (value, name)) -class gl_print_base: +class gl_print_base(object): """Base class of all API pretty-printers. In the model-view-controller pattern, this is the view. Any derived @@ -322,7 +322,7 @@ def create_parameter_string(parameters, include_names): return string.join(list, ", ") -class gl_item: +class gl_item(object): def __init__(self, element, context): self.context = context self.name = element.nsProp( "name", None ) @@ -401,7 +401,7 @@ class gl_enum( gl_item ): -class gl_parameter: +class gl_parameter(object): def __init__(self, element, context): self.name = element.nsProp( "name", None ) @@ -780,7 +780,7 @@ class gl_function( gl_item ): return "_dispatch_stub_%u" % (self.offset) -class gl_item_factory: +class gl_item_factory(object): """Factory to create objects derived from gl_item.""" def create_item(self, item_name, element, context): @@ -798,7 +798,7 @@ class gl_item_factory: return None -class gl_api: +class gl_api(object): def __init__(self, factory): self.functions_by_name = {} self.enums_by_name = {} diff --git a/src/mapi/glapi/gen/typeexpr.py b/src/mapi/glapi/gen/typeexpr.py index 6cc71cbf91f..ed23d23ff8e 100644 --- a/src/mapi/glapi/gen/typeexpr.py +++ b/src/mapi/glapi/gen/typeexpr.py @@ -27,7 +27,7 @@ import string, copy -class type_node: +class type_node(object): def __init__(self): self.pointer = 0 # bool self.const = 0 # bool @@ -65,7 +65,7 @@ class type_node: return s -class type_table: +class type_table(object): def __init__(self): self.types_by_name = {} return @@ -109,7 +109,7 @@ def create_initial_types(): return -class type_expression: +class type_expression(object): built_in_types = None def __init__(self, type_string, extra_types = None):