Remove functions in string module that are also string methods. Also remove:

* all calls to functions in the string module (except maketrans)
 * everything from stropmodule except for maketrans() which is still used
This commit is contained in:
Neal Norwitz 2007-04-17 08:48:32 +00:00
parent ff11334927
commit 9d72bb452b
69 changed files with 396 additions and 2113 deletions

View file

@ -8,7 +8,7 @@ extensions ASAP)."""
__revision__ = "$Id$"
import sys, os, string, re
import sys, os, re
from types import *
from distutils.core import Command
from distutils.errors import *
@ -138,7 +138,7 @@ class build_ext (Command):
if self.include_dirs is None:
self.include_dirs = self.distribution.include_dirs or []
if type(self.include_dirs) is StringType:
self.include_dirs = string.split(self.include_dirs, os.pathsep)
self.include_dirs = self.include_dirs.split(os.pathsep)
# Put the Python "system" include dir at the end, so that
# any local include dirs take precedence.
@ -156,12 +156,12 @@ class build_ext (Command):
if self.library_dirs is None:
self.library_dirs = []
elif type(self.library_dirs) is StringType:
self.library_dirs = string.split(self.library_dirs, os.pathsep)
self.library_dirs = self.library_dirs.split(os.pathsep)
if self.rpath is None:
self.rpath = []
elif type(self.rpath) is StringType:
self.rpath = string.split(self.rpath, os.pathsep)
self.rpath = self.rpath.split(os.pathsep)
# for extensions under windows use different directories
# for Release and Debug builds.
@ -186,7 +186,7 @@ class build_ext (Command):
# for extensions under Cygwin and AtheOS Python's library directory must be
# appended to library_dirs
if sys.platform[:6] == 'cygwin' or sys.platform[:6] == 'atheos':
if string.find(sys.executable, sys.exec_prefix) != -1:
if sys.executable.find(sys.exec_prefix) != -1:
# building third party extensions
self.library_dirs.append(os.path.join(sys.prefix, "lib",
"python" + get_python_version(),
@ -199,7 +199,7 @@ class build_ext (Command):
# Python's library directory must be appended to library_dirs
if (sys.platform.startswith('linux') or sys.platform.startswith('gnu')) \
and sysconfig.get_config_var('Py_ENABLE_SHARED'):
if string.find(sys.executable, sys.exec_prefix) != -1:
if sys.executable.find(sys.exec_prefix) != -1:
# building third party extensions
self.library_dirs.append(sysconfig.get_config_var('LIBDIR'))
else:
@ -212,14 +212,14 @@ class build_ext (Command):
# symbols can be separated with commas.
if self.define:
defines = string.split(self.define, ',')
defines = self.define.split(',')
self.define = map(lambda symbol: (symbol, '1'), defines)
# The option for macros to undefine is also a string from the
# option parsing, but has to be a list. Multiple symbols can also
# be separated with commas here.
if self.undef:
self.undef = string.split(self.undef, ',')
self.undef = self.undef.split(',')
if self.swig_opts is None:
self.swig_opts = []
@ -429,8 +429,8 @@ class build_ext (Command):
# ignore build-lib -- put the compiled extension into
# the source tree along with pure Python modules
modpath = string.split(fullname, '.')
package = string.join(modpath[0:-1], '.')
modpath = fullname.split('.')
package = '.'.join(modpath[0:-1])
base = modpath[-1]
build_py = self.get_finalized_command('build_py')
@ -617,7 +617,7 @@ class build_ext (Command):
"""
from distutils.sysconfig import get_config_var
ext_path = string.split(ext_name, '.')
ext_path = ext_name.split('.')
# OS/2 has an 8 character module (extension) limit :-(
if os.name == "os2":
ext_path[len(ext_path) - 1] = ext_path[len(ext_path) - 1][:8]
@ -634,7 +634,7 @@ class build_ext (Command):
the .pyd file (DLL) must export the module "init" function.
"""
initfunc_name = "init" + string.split(ext.name,'.')[-1]
initfunc_name = "init" + ext.name.split('.')[-1]
if initfunc_name not in ext.export_symbols:
ext.export_symbols.append(initfunc_name)
return ext.export_symbols