Rather than using the string module, use the same method for the str
instance (join, split, replace, etc).

It's more forward looking, since it will make smoothing over the
str/bytes/unicode problem between python 2 and python 3. It's also more
standard, using the string module isn't very common.

Signed-off-by: Dylan Baker <[email protected]>
---
 src/mapi/glapi/gen/glX_proto_common.py |  4 +---
 src/mapi/glapi/gen/glX_proto_recv.py   |  3 +--
 src/mapi/glapi/gen/glX_proto_send.py   | 15 +++++++--------
 src/mapi/glapi/gen/glX_proto_size.py   |  3 +--
 src/mapi/glapi/gen/gl_XML.py           |  7 +++----
 src/mapi/glapi/gen/typeexpr.py         |  3 +--
 6 files changed, 14 insertions(+), 21 deletions(-)

diff --git a/src/mapi/glapi/gen/glX_proto_common.py 
b/src/mapi/glapi/gen/glX_proto_common.py
index d27f784..b1db0f7 100644
--- a/src/mapi/glapi/gen/glX_proto_common.py
+++ b/src/mapi/glapi/gen/glX_proto_common.py
@@ -26,8 +26,6 @@
 # Authors:
 #    Ian Romanick <[email protected]>
 
-import string
-
 import gl_XML
 import glX_XML
 
@@ -67,7 +65,7 @@ class glx_print_proto(gl_XML.gl_print_base):
                     return compsize
 
                 elif len(param.count_parameter_list):
-                    parameters = string.join(param.count_parameter_list, ",")
+                    parameters = ','.join(param.count_parameter_list)
                     compsize = "__gl%s_size(%s)" % (func.name, parameters)
 
                     return compsize
diff --git a/src/mapi/glapi/gen/glX_proto_recv.py 
b/src/mapi/glapi/gen/glX_proto_recv.py
index 651ac14..d0a6371 100644
--- a/src/mapi/glapi/gen/glX_proto_recv.py
+++ b/src/mapi/glapi/gen/glX_proto_recv.py
@@ -27,7 +27,6 @@
 #    Ian Romanick <[email protected]>
 
 import argparse
-import string
 
 import glX_proto_common
 import gl_XML
@@ -221,7 +220,7 @@ class 
PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto):
 
             list.append('%s        %s' % (indent, location))
 
-        print '%s    %s%s%s(%s);' % (indent, retval_assign, prefix, f.name, 
string.join(list, ',\n'))
+        print '%s    %s%s%s(%s);' % (indent, retval_assign, prefix, f.name, 
',\n'.join(list))
 
     def common_func_print_just_start(self, f, indent):
         align64 = 0
diff --git a/src/mapi/glapi/gen/glX_proto_send.py 
b/src/mapi/glapi/gen/glX_proto_send.py
index 9dcffa6..d2166d2 100644
--- a/src/mapi/glapi/gen/glX_proto_send.py
+++ b/src/mapi/glapi/gen/glX_proto_send.py
@@ -30,7 +30,6 @@
 
 import argparse
 import copy
-import string
 import textwrap
 
 import gl_XML
@@ -41,14 +40,14 @@ import license
 
 def convertStringForXCB(str):
     tmp = ""
-    special = [ "ARB" ]
+    special = ["ARB"]
     i = 0
     while i < len(str):
         if str[i:i+3] in special:
-            tmp = '%s_%s' % (tmp, string.lower(str[i:i+3]))
-            i = i + 2;
+            tmp = '%s_%s' % (tmp, str[i:i+3].lower())
+            i = i + 2
         elif str[i].isupper():
-            tmp = '%s_%s' % (tmp, string.lower(str[i]))
+            tmp = '%s_%s' % (tmp, str[i].lower())
         else:
             tmp = '%s%s' % (tmp, str[i])
         i += 1
@@ -609,9 +608,9 @@ class PrintGlxProtoStubs(glX_proto_common.glx_print_proto):
         if skip_condition:
             condition_list.append(skip_condition)
 
-        if len( condition_list ) > 0:
-            if len( condition_list ) > 1:
-                skip_condition = "(%s)" % (string.join( condition_list, ") && 
(" ))
+        if len(condition_list) > 0:
+            if len(condition_list) > 1:
+                skip_condition = "(%s)" % (") && (".join(condition_list))
             else:
                 skip_condition = "%s" % (condition_list.pop(0))
 
diff --git a/src/mapi/glapi/gen/glX_proto_size.py 
b/src/mapi/glapi/gen/glX_proto_size.py
index c157c00..9ece1e1 100644
--- a/src/mapi/glapi/gen/glX_proto_size.py
+++ b/src/mapi/glapi/gen/glX_proto_size.py
@@ -27,7 +27,6 @@
 #    Ian Romanick <[email protected]>
 
 import argparse
-import string
 import textwrap
 
 import glX_XML
@@ -277,7 +276,7 @@ class glx_server_enum_function(glx_enum_function):
         printer.common_emit_fixups(fixup)
 
         print ''
-        print '    compsize = __gl%s_size(%s);' % (f.name, 
string.join(f.count_parameter_list, ","))
+        print '    compsize = __gl%s_size(%s);' % (f.name, 
','.join(f.count_parameter_list))
         p = f.variable_length_parameter()
         print '    return __GLX_PAD(%s);' % (p.size_string())
 
diff --git a/src/mapi/glapi/gen/gl_XML.py b/src/mapi/glapi/gen/gl_XML.py
index f857ad6..d37ebdd 100644
--- a/src/mapi/glapi/gen/gl_XML.py
+++ b/src/mapi/glapi/gen/gl_XML.py
@@ -31,7 +31,6 @@
 from decimal import Decimal
 import os.path
 import re
-import string
 import textwrap
 import xml.etree.ElementTree as ET
 
@@ -310,7 +309,7 @@ def create_parameter_string(parameters, include_names):
 
     if len(list) == 0: list = ["void"]
 
-    return string.join(list, ", ")
+    return ', '.join(list)
 
 
 class gl_item(object):
@@ -546,9 +545,9 @@ class gl_parameter(object):
                 list.append(str(s))
 
             if len(list) > 1 and use_parens:
-                return "(%s)" % (string.join(list, " * "))
+                return "(%s)" % (' * '.join(list))
             else:
-                return string.join(list, " * ")
+                return ' * '.join(list)
 
         elif self.is_image():
             return "compsize"
diff --git a/src/mapi/glapi/gen/typeexpr.py b/src/mapi/glapi/gen/typeexpr.py
index 199dfee..adb54c1 100644
--- a/src/mapi/glapi/gen/typeexpr.py
+++ b/src/mapi/glapi/gen/typeexpr.py
@@ -27,7 +27,6 @@
 #    Ian Romanick <[email protected]>
 
 import copy
-import string
 
 
 class type_node(object):
@@ -123,7 +122,7 @@ class type_expression(object):
 
         # Replace '*' with ' * ' in type_string.  Then, split the string
         # into tokens, separated by spaces.
-        tokens = string.split(string.replace(type_string, "*", " * "))
+        tokens = type_string.replace('*', ' * ').split()
 
         const = 0
         t = None
-- 
2.8.0

_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to