String method conversion.
This commit is contained in:
parent
7e642e82d3
commit
b3acd3e4d3
|
@ -365,10 +365,10 @@ def check_config_h():
|
||||||
# "config.h" check -- should probably be renamed...
|
# "config.h" check -- should probably be renamed...
|
||||||
|
|
||||||
from distutils import sysconfig
|
from distutils import sysconfig
|
||||||
import string,sys
|
import sys
|
||||||
# if sys.version contains GCC then python was compiled with
|
# if sys.version contains GCC then python was compiled with
|
||||||
# GCC, and the config.h file should be OK
|
# GCC, and the config.h file should be OK
|
||||||
if string.find(sys.version,"GCC") >= 0:
|
if sys.version.find("GCC") >= 0:
|
||||||
return (CONFIG_H_OK, "sys.version mentions 'GCC'")
|
return (CONFIG_H_OK, "sys.version mentions 'GCC'")
|
||||||
|
|
||||||
fn = sysconfig.get_config_h_filename()
|
fn = sysconfig.get_config_h_filename()
|
||||||
|
@ -387,7 +387,7 @@ def check_config_h():
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# "config.h" contains an "#ifdef __GNUC__" or something similar
|
# "config.h" contains an "#ifdef __GNUC__" or something similar
|
||||||
if string.find(s,"__GNUC__") >= 0:
|
if s.find("__GNUC__") >= 0:
|
||||||
return (CONFIG_H_OK, "'%s' mentions '__GNUC__'" % fn)
|
return (CONFIG_H_OK, "'%s' mentions '__GNUC__'" % fn)
|
||||||
else:
|
else:
|
||||||
return (CONFIG_H_NOTOK, "'%s' does not mention '__GNUC__'" % fn)
|
return (CONFIG_H_NOTOK, "'%s' does not mention '__GNUC__'" % fn)
|
||||||
|
|
|
@ -7,7 +7,7 @@ modules in setup scripts."""
|
||||||
|
|
||||||
__revision__ = "$Id$"
|
__revision__ = "$Id$"
|
||||||
|
|
||||||
import os, string
|
import os
|
||||||
from types import *
|
from types import *
|
||||||
|
|
||||||
|
|
||||||
|
@ -168,7 +168,7 @@ def read_setup_file (filename):
|
||||||
elif switch == "-I":
|
elif switch == "-I":
|
||||||
ext.include_dirs.append(value)
|
ext.include_dirs.append(value)
|
||||||
elif switch == "-D":
|
elif switch == "-D":
|
||||||
equals = string.find(value, "=")
|
equals = value.find("=")
|
||||||
if equals == -1: # bare "-DFOO" -- no value
|
if equals == -1: # bare "-DFOO" -- no value
|
||||||
ext.define_macros.append((value, None))
|
ext.define_macros.append((value, None))
|
||||||
else: # "-DFOO=blah"
|
else: # "-DFOO=blah"
|
||||||
|
|
|
@ -112,12 +112,12 @@ class StrictVersion (Version):
|
||||||
match.group(1, 2, 4, 5, 6)
|
match.group(1, 2, 4, 5, 6)
|
||||||
|
|
||||||
if patch:
|
if patch:
|
||||||
self.version = tuple(map(string.atoi, [major, minor, patch]))
|
self.version = tuple(map(int, [major, minor, patch]))
|
||||||
else:
|
else:
|
||||||
self.version = tuple(map(string.atoi, [major, minor]) + [0])
|
self.version = tuple(map(int, [major, minor]) + [0])
|
||||||
|
|
||||||
if prerelease:
|
if prerelease:
|
||||||
self.prerelease = (prerelease[0], string.atoi(prerelease_num))
|
self.prerelease = (prerelease[0], int(prerelease_num))
|
||||||
else:
|
else:
|
||||||
self.prerelease = None
|
self.prerelease = None
|
||||||
|
|
||||||
|
@ -125,9 +125,9 @@ class StrictVersion (Version):
|
||||||
def __str__ (self):
|
def __str__ (self):
|
||||||
|
|
||||||
if self.version[2] == 0:
|
if self.version[2] == 0:
|
||||||
vstring = string.join(map(str, self.version[0:2]), '.')
|
vstring = '.'.join(map(str, self.version[0:2]))
|
||||||
else:
|
else:
|
||||||
vstring = string.join(map(str, self.version), '.')
|
vstring = '.'.join(map(str, self.version))
|
||||||
|
|
||||||
if self.prerelease:
|
if self.prerelease:
|
||||||
vstring = vstring + self.prerelease[0] + str(self.prerelease[1])
|
vstring = vstring + self.prerelease[0] + str(self.prerelease[1])
|
||||||
|
|
|
@ -25,8 +25,8 @@ class Cdplayer:
|
||||||
t = []
|
t = []
|
||||||
for i in range(2, len(tracklist), 4):
|
for i in range(2, len(tracklist), 4):
|
||||||
t.append((None, \
|
t.append((None, \
|
||||||
(string.atoi(tracklist[i:i+2]), \
|
(int(tracklist[i:i+2]), \
|
||||||
string.atoi(tracklist[i+2:i+4]))))
|
int(tracklist[i+2:i+4]))))
|
||||||
tracklist = t
|
tracklist = t
|
||||||
self.track = [None] + [''] * len(tracklist)
|
self.track = [None] + [''] * len(tracklist)
|
||||||
self.id = 'd' + string.zfill(len(tracklist), 2)
|
self.id = 'd' + string.zfill(len(tracklist), 2)
|
||||||
|
@ -59,7 +59,7 @@ class Cdplayer:
|
||||||
elif name == 'artist':
|
elif name == 'artist':
|
||||||
self.artist = value
|
self.artist = value
|
||||||
elif name[:5] == 'track':
|
elif name[:5] == 'track':
|
||||||
trackno = string.atoi(name[6:])
|
trackno = int(name[6:])
|
||||||
self.track[trackno] = value
|
self.track[trackno] = value
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
#
|
#
|
||||||
# Jack Jansen, December 1991
|
# Jack Jansen, December 1991
|
||||||
#
|
#
|
||||||
import string
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import FL
|
import FL
|
||||||
|
@ -248,7 +247,7 @@ def _parse_num(str):
|
||||||
return eval(str)
|
return eval(str)
|
||||||
|
|
||||||
def _parse_numlist(str):
|
def _parse_numlist(str):
|
||||||
slist = string.split(str)
|
slist = str.split()
|
||||||
nlist = []
|
nlist = []
|
||||||
for i in slist:
|
for i in slist:
|
||||||
nlist.append(_parse_num(i))
|
nlist.append(_parse_num(i))
|
||||||
|
@ -277,9 +276,9 @@ def _parse_line(line):
|
||||||
return line
|
return line
|
||||||
name, value = match.group(1, 2)
|
name, value = match.group(1, 2)
|
||||||
if name[0] == 'N':
|
if name[0] == 'N':
|
||||||
name = string.join(string.split(name),'')
|
name = ''.join(name.split())
|
||||||
name = string.lower(name)
|
name = name.lower()
|
||||||
name = string.capitalize(name)
|
name = name.capitalize()
|
||||||
try:
|
try:
|
||||||
pf = _parse_func[name]
|
pf = _parse_func[name]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
|
Loading…
Reference in New Issue