diff options
author | Dylan Baker <baker.dylan.c@gmail.com> | 2016-03-29 10:11:56 -0700 |
---|---|---|
committer | Dylan Baker <baker.dylan.c@gmail.com> | 2016-03-31 15:52:22 -0700 |
commit | 899993b02336a863bb7a8686d1b1ee148aefc407 (patch) | |
tree | 4abc4fdfabff8fd1ebea0a45bb1ac25280a8243a | |
parent | 2b4c1cccf30d41f2d0b4a6fe6d190919c47e8046 (diff) |
glapi: Don't use string module in python modules
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 <dylanx.c.baker@intel.com>
-rw-r--r-- | src/mapi/glapi/gen/glX_proto_common.py | 4 | ||||
-rw-r--r-- | src/mapi/glapi/gen/glX_proto_recv.py | 3 | ||||
-rw-r--r-- | src/mapi/glapi/gen/glX_proto_send.py | 15 | ||||
-rw-r--r-- | src/mapi/glapi/gen/glX_proto_size.py | 3 | ||||
-rw-r--r-- | src/mapi/glapi/gen/gl_XML.py | 7 | ||||
-rw-r--r-- | 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 d27f7848d0..b1db0f7022 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 <idr@us.ibm.com> -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 651ac14177..d0a6371bde 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 <idr@us.ibm.com> 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 9dcffa67ac..d2166d2d2e 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 c157c00388..9ece1e1914 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 <idr@us.ibm.com> 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 f857ad6271..d37ebddbd9 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 199dfeed41..adb54c1401 100644 --- a/src/mapi/glapi/gen/typeexpr.py +++ b/src/mapi/glapi/gen/typeexpr.py @@ -27,7 +27,6 @@ # Ian Romanick <idr@us.ibm.com> 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 |