summaryrefslogtreecommitdiffstats
path: root/Tools/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/scripts')
-rwxr-xr-xTools/scripts/byteyears.py2
-rwxr-xr-xTools/scripts/checkappend.py12
-rwxr-xr-xTools/scripts/checkpyc.py18
-rwxr-xr-xTools/scripts/classfix.py19
-rwxr-xr-xTools/scripts/dutree.py2
-rwxr-xr-xTools/scripts/fixcid.py18
-rwxr-xr-xTools/scripts/fixps.py2
-rwxr-xr-xTools/scripts/ftpmirror.py72
-rwxr-xr-xTools/scripts/methfix.py19
-rwxr-xr-xTools/scripts/pathfix.py16
-rw-r--r--Tools/scripts/redemo.py2
-rwxr-xr-xTools/scripts/suff.py2
-rwxr-xr-xTools/scripts/texi2html.py20
-rwxr-xr-xTools/scripts/untabify.py2
-rwxr-xr-xTools/scripts/which.py2
15 files changed, 97 insertions, 111 deletions
diff --git a/Tools/scripts/byteyears.py b/Tools/scripts/byteyears.py
index 9c2a974..b2a114f 100755
--- a/Tools/scripts/byteyears.py
+++ b/Tools/scripts/byteyears.py
@@ -42,7 +42,7 @@ for filename in sys.argv[1:]:
try:
st = statfunc(filename)
except os.error, msg:
- sys.stderr.write('can\'t stat ' + `filename` + ': ' + `msg` + '\n')
+ sys.stderr.write("can't stat %r: %r\n" % (filename, msg))
status = 1
st = ()
if st:
diff --git a/Tools/scripts/checkappend.py b/Tools/scripts/checkappend.py
index b3141df..a8714d9 100755
--- a/Tools/scripts/checkappend.py
+++ b/Tools/scripts/checkappend.py
@@ -65,7 +65,7 @@ def main():
def check(file):
if os.path.isdir(file) and not os.path.islink(file):
if verbose:
- print "%s: listing directory" % `file`
+ print "%r: listing directory" % (file,)
names = os.listdir(file)
for name in names:
fullname = os.path.join(file, name)
@@ -78,15 +78,15 @@ def check(file):
try:
f = open(file)
except IOError, msg:
- errprint("%s: I/O Error: %s" % (`file`, str(msg)))
+ errprint("%r: I/O Error: %s" % (file, msg))
return
if verbose > 1:
- print "checking", `file`, "..."
+ print "checking %r ..." % (file,)
ok = AppendChecker(file, f).run()
if verbose and ok:
- print "%s: Clean bill of health." % `file`
+ print "%r: Clean bill of health." % (file,)
[FIND_DOT,
FIND_APPEND,
@@ -105,7 +105,7 @@ class AppendChecker:
try:
tokenize.tokenize(self.file.readline, self.tokeneater)
except tokenize.TokenError, msg:
- errprint("%s: Token Error: %s" % (`self.fname`, str(msg)))
+ errprint("%r: Token Error: %s" % (self.fname, msg))
self.nerrors = self.nerrors + 1
return self.nerrors == 0
@@ -159,7 +159,7 @@ class AppendChecker:
state = FIND_DOT
else:
- raise SystemError("unknown internal state '%s'" % `state`)
+ raise SystemError("unknown internal state '%r'" % (state,))
self.state = state
diff --git a/Tools/scripts/checkpyc.py b/Tools/scripts/checkpyc.py
index b38b456..d5f3c7a 100755
--- a/Tools/scripts/checkpyc.py
+++ b/Tools/scripts/checkpyc.py
@@ -17,15 +17,15 @@ def main():
silent = 1
MAGIC = imp.get_magic()
if not silent:
- print 'Using MAGIC word', `MAGIC`
+ print 'Using MAGIC word', repr(MAGIC)
for dirname in sys.path:
try:
names = os.listdir(dirname)
except os.error:
- print 'Cannot list directory', `dirname`
+ print 'Cannot list directory', repr(dirname)
continue
if not silent:
- print 'Checking', `dirname`, '...'
+ print 'Checking ', repr(dirname), '...'
names.sort()
for name in names:
if name[-3:] == '.py':
@@ -33,29 +33,29 @@ def main():
try:
st = os.stat(name)
except os.error:
- print 'Cannot stat', `name`
+ print 'Cannot stat', repr(name)
continue
if verbose:
- print 'Check', `name`, '...'
+ print 'Check', repr(name), '...'
name_c = name + 'c'
try:
f = open(name_c, 'r')
except IOError:
- print 'Cannot open', `name_c`
+ print 'Cannot open', repr(name_c)
continue
magic_str = f.read(4)
mtime_str = f.read(4)
f.close()
if magic_str <> MAGIC:
print 'Bad MAGIC word in ".pyc" file',
- print `name_c`
+ print repr(name_c)
continue
mtime = get_long(mtime_str)
if mtime == 0 or mtime == -1:
- print 'Bad ".pyc" file', `name_c`
+ print 'Bad ".pyc" file', repr(name_c)
elif mtime <> st[ST_MTIME]:
print 'Out-of-date ".pyc" file',
- print `name_c`
+ print repr(name_c)
def get_long(s):
if len(s) <> 4:
diff --git a/Tools/scripts/classfix.py b/Tools/scripts/classfix.py
index 7b86aa3..520b352 100755
--- a/Tools/scripts/classfix.py
+++ b/Tools/scripts/classfix.py
@@ -58,12 +58,12 @@ def ispython(name):
return ispythonprog.match(name) >= 0
def recursedown(dirname):
- dbg('recursedown(' + `dirname` + ')\n')
+ dbg('recursedown(%r)\n' % (dirname,))
bad = 0
try:
names = os.listdir(dirname)
except os.error, msg:
- err(dirname + ': cannot list directory: ' + `msg` + '\n')
+ err('%s: cannot list directory: %r\n' % (dirname, msg))
return 1
names.sort()
subdirs = []
@@ -80,11 +80,11 @@ def recursedown(dirname):
return bad
def fix(filename):
-## dbg('fix(' + `filename` + ')\n')
+## dbg('fix(%r)\n' % (filename,))
try:
f = open(filename, 'r')
except IOError, msg:
- err(filename + ': cannot open: ' + `msg` + '\n')
+ err('%s: cannot open: %r\n' % (filename, msg))
return 1
head, tail = os.path.split(filename)
tempname = os.path.join(head, '@' + tail)
@@ -108,14 +108,13 @@ def fix(filename):
g = open(tempname, 'w')
except IOError, msg:
f.close()
- err(tempname+': cannot create: '+\
- `msg`+'\n')
+ err('%s: cannot create: %r\n' % (tempname, msg))
return 1
f.seek(0)
lineno = 0
rep(filename + ':\n')
continue # restart from the beginning
- rep(`lineno` + '\n')
+ rep(repr(lineno) + '\n')
rep('< ' + line)
rep('> ' + newline)
if g is not None:
@@ -132,17 +131,17 @@ def fix(filename):
statbuf = os.stat(filename)
os.chmod(tempname, statbuf[ST_MODE] & 07777)
except os.error, msg:
- err(tempname + ': warning: chmod failed (' + `msg` + ')\n')
+ err('%s: warning: chmod failed (%r)\n' % (tempname, msg))
# Then make a backup of the original file as filename~
try:
os.rename(filename, filename + '~')
except os.error, msg:
- err(filename + ': warning: backup failed (' + `msg` + ')\n')
+ err('%s: warning: backup failed (%r)\n' % (filename, msg))
# Now move the temp file to the original file
try:
os.rename(tempname, filename)
except os.error, msg:
- err(filename + ': rename failed (' + `msg` + ')\n')
+ err('%s: rename failed (%r)\n' % (filename, msg))
return 1
# Return succes
return 0
diff --git a/Tools/scripts/dutree.py b/Tools/scripts/dutree.py
index 857a5cc..a49d80a 100755
--- a/Tools/scripts/dutree.py
+++ b/Tools/scripts/dutree.py
@@ -46,7 +46,7 @@ def show(total, d, prefix):
## list.append((total - sum, os.curdir))
list.sort()
list.reverse()
- width = len(`list[0][0]`)
+ width = len(repr(list[0][0]))
for tsub, key in list:
if tsub is None:
psub = prefix
diff --git a/Tools/scripts/fixcid.py b/Tools/scripts/fixcid.py
index 8bc1de0..76841fe 100755
--- a/Tools/scripts/fixcid.py
+++ b/Tools/scripts/fixcid.py
@@ -93,7 +93,7 @@ def wanted(name):
return regex.match(Wanted, name) >= 0
def recursedown(dirname):
- dbg('recursedown(' + `dirname` + ')\n')
+ dbg('recursedown(%r)\n' % (dirname,))
bad = 0
try:
names = os.listdir(dirname)
@@ -115,7 +115,7 @@ def recursedown(dirname):
return bad
def fix(filename):
-## dbg('fix(' + `filename` + ')\n')
+## dbg('fix(%r)\n' % (filename,))
if filename == '-':
# Filter mode
f = sys.stdin
@@ -158,7 +158,7 @@ def fix(filename):
initfixline()
rep(filename + ':\n')
continue # restart from the beginning
- rep(`lineno` + '\n')
+ rep(repr(lineno) + '\n')
rep('< ' + line)
rep('> ' + newline)
if g is not None:
@@ -225,7 +225,7 @@ def initfixline():
def fixline(line):
global Program
-## print '-->', `line`
+## print '-->', repr(line)
i = 0
while i < len(line):
i = Program.search(line, i)
@@ -293,8 +293,7 @@ def addsubst(substfile):
if len(words) == 3 and words[0] == 'struct':
words[:2] = [words[0] + ' ' + words[1]]
elif len(words) <> 2:
- err(substfile + ':' + `lineno` +
- ': warning: bad line: ' + line)
+ err(substfile + '%s:%r: warning: bad line: %r' % (substfile, lineno, line))
continue
if Reverse:
[value, key] = words
@@ -306,11 +305,8 @@ def addsubst(substfile):
key = key[1:]
NotInComment[key] = value
if Dict.has_key(key):
- err(substfile + ':' + `lineno` +
- ': warning: overriding: ' +
- key + ' ' + value + '\n')
- err(substfile + ':' + `lineno` +
- ': warning: previous: ' + Dict[key] + '\n')
+ err('%s:%r: warning: overriding: %r %r\n' % (substfile, lineno, key, value))
+ err('%s:%r: warning: previous: %r\n' % (substfile, lineno, Dict[key]))
Dict[key] = value
fp.close()
diff --git a/Tools/scripts/fixps.py b/Tools/scripts/fixps.py
index e406571..12e9f43 100755
--- a/Tools/scripts/fixps.py
+++ b/Tools/scripts/fixps.py
@@ -23,7 +23,7 @@ def main():
f.close()
line = re.sub('/usr/local/bin/python',
'/usr/bin/env python', line)
- print filename, ':', `line`
+ print filename, ':', repr(line)
f = open(filename, "w")
f.write(line)
f.write(rest)
diff --git a/Tools/scripts/ftpmirror.py b/Tools/scripts/ftpmirror.py
index 41607b0..0f918b8 100755
--- a/Tools/scripts/ftpmirror.py
+++ b/Tools/scripts/ftpmirror.py
@@ -87,17 +87,17 @@ def main():
f.connect(host,port)
if not nologin:
if verbose:
- print 'Logging in as %s...' % `login or 'anonymous'`
+ print 'Logging in as %r...' % (login or 'anonymous')
f.login(login, passwd, account)
if verbose: print 'OK.'
pwd = f.pwd()
- if verbose > 1: print 'PWD =', `pwd`
+ if verbose > 1: print 'PWD =', repr(pwd)
if remotedir:
- if verbose > 1: print 'cwd(%s)' % `remotedir`
+ if verbose > 1: print 'cwd(%s)' % repr(remotedir)
f.cwd(remotedir)
if verbose > 1: print 'OK.'
pwd = f.pwd()
- if verbose > 1: print 'PWD =', `pwd`
+ if verbose > 1: print 'PWD =', repr(pwd)
#
mirrorsubdir(f, localdir)
@@ -105,11 +105,11 @@ def main():
def mirrorsubdir(f, localdir):
pwd = f.pwd()
if localdir and not os.path.isdir(localdir):
- if verbose: print 'Creating local directory', `localdir`
+ if verbose: print 'Creating local directory', repr(localdir)
try:
makedir(localdir)
except os.error, msg:
- print "Failed to establish local directory", `localdir`
+ print "Failed to establish local directory", repr(localdir)
return
infofilename = os.path.join(localdir, '.mirrorinfo')
try:
@@ -119,15 +119,15 @@ def mirrorsubdir(f, localdir):
try:
info = eval(text)
except (SyntaxError, NameError):
- print 'Bad mirror info in %s' % `infofilename`
+ print 'Bad mirror info in', repr(infofilename)
info = {}
subdirs = []
listing = []
- if verbose: print 'Listing remote directory %s...' % `pwd`
+ if verbose: print 'Listing remote directory %r...' % (pwd,)
f.retrlines('LIST', listing.append)
filesfound = []
for line in listing:
- if verbose > 1: print '-->', `line`
+ if verbose > 1: print '-->', repr(line)
if mac:
# Mac listing has just filenames;
# trailing / means subdirectory
@@ -148,7 +148,7 @@ def mirrorsubdir(f, localdir):
if i >= 0:
# words[0] had better start with 'l'...
if verbose > 1:
- print 'Found symbolic link %s' % `filename`
+ print 'Found symbolic link %r' % (filename,)
linkto = filename[i+4:]
filename = filename[:i]
infostuff = words[-5:-1]
@@ -157,21 +157,21 @@ def mirrorsubdir(f, localdir):
for pat in skippats:
if fnmatch(filename, pat):
if verbose > 1:
- print 'Skip pattern', `pat`,
- print 'matches', `filename`
+ print 'Skip pattern', repr(pat),
+ print 'matches', repr(filename)
skip = 1
break
if skip:
continue
if mode[0] == 'd':
if verbose > 1:
- print 'Remembering subdirectory', `filename`
+ print 'Remembering subdirectory', repr(filename)
subdirs.append(filename)
continue
filesfound.append(filename)
if info.has_key(filename) and info[filename] == infostuff:
if verbose > 1:
- print 'Already have this version of',`filename`
+ print 'Already have this version of',repr(filename)
continue
fullname = os.path.join(localdir, filename)
tempname = os.path.join(localdir, '@'+filename)
@@ -187,24 +187,20 @@ def mirrorsubdir(f, localdir):
pass
if mode[0] == 'l':
if verbose:
- print "Creating symlink %s -> %s" % (
- `filename`, `linkto`)
+ print "Creating symlink %r -> %r" % (filename, linkto)
try:
os.symlink(linkto, tempname)
except IOError, msg:
- print "Can't create %s: %s" % (
- `tempname`, str(msg))
+ print "Can't create %r: %s" % (tempname, msg)
continue
else:
try:
fp = open(tempname, 'wb')
except IOError, msg:
- print "Can't create %s: %s" % (
- `tempname`, str(msg))
+ print "Can't create %r: %s" % (tempname, msg)
continue
if verbose:
- print 'Retrieving %s from %s as %s...' % \
- (`filename`, `pwd`, `fullname`)
+ print 'Retrieving %r from %r as %r...' % (filename, pwd, fullname)
if verbose:
fp1 = LoggingFile(fp, 1024, sys.stdout)
else:
@@ -227,9 +223,7 @@ def mirrorsubdir(f, localdir):
try:
os.rename(tempname, fullname)
except os.error, msg:
- print "Can't rename %s to %s: %s" % (`tempname`,
- `fullname`,
- str(msg))
+ print "Can't rename %r to %r: %s" % (tempname, fullname, msg)
continue
info[filename] = infostuff
writedict(info, infofilename)
@@ -251,7 +245,7 @@ def mirrorsubdir(f, localdir):
if filename not in filesfound:
if verbose:
print "Removing obsolete info entry for",
- print `filename`, "in", `localdir or "."`
+ print repr(filename), "in", repr(localdir or ".")
del info[filename]
deletions = deletions + 1
if deletions:
@@ -270,8 +264,8 @@ def mirrorsubdir(f, localdir):
for pat in skippats:
if fnmatch(name, pat):
if verbose > 1:
- print 'Skip pattern', `pat`,
- print 'matches', `name`
+ print 'Skip pattern', repr(pat),
+ print 'matches', repr(name)
skip = 1
break
if skip:
@@ -279,10 +273,10 @@ def mirrorsubdir(f, localdir):
fullname = os.path.join(localdir, name)
if not rmok:
if verbose:
- print 'Local file', `fullname`,
+ print 'Local file', repr(fullname),
print 'is no longer pertinent'
continue
- if verbose: print 'Removing local file/dir', `fullname`
+ if verbose: print 'Removing local file/dir', repr(fullname)
remove(fullname)
#
# Recursively mirror subdirectories
@@ -290,18 +284,18 @@ def mirrorsubdir(f, localdir):
if interactive:
doit = askabout('subdirectory', subdir, pwd)
if not doit: continue
- if verbose: print 'Processing subdirectory', `subdir`
+ if verbose: print 'Processing subdirectory', repr(subdir)
localsubdir = os.path.join(localdir, subdir)
pwd = f.pwd()
if verbose > 1:
- print 'Remote directory now:', `pwd`
- print 'Remote cwd', `subdir`
+ print 'Remote directory now:', repr(pwd)
+ print 'Remote cwd', repr(subdir)
try:
f.cwd(subdir)
except ftplib.error_perm, msg:
- print "Can't chdir to", `subdir`, ":", `msg`
+ print "Can't chdir to", repr(subdir), ":", repr(msg)
else:
- if verbose: print 'Mirroring as', `localsubdir`
+ if verbose: print 'Mirroring as', repr(localsubdir)
mirrorsubdir(f, localsubdir)
if verbose > 1: print 'Remote cwd ..'
f.cwd('..')
@@ -329,15 +323,13 @@ def remove(fullname):
try:
os.rmdir(fullname)
except os.error, msg:
- print "Can't remove local directory %s: %s" % \
- (`fullname`, str(msg))
+ print "Can't remove local directory %r: %s" % (fullname, msg)
return 0
else:
try:
os.unlink(fullname)
except os.error, msg:
- print "Can't remove local file %s: %s" % \
- (`fullname`, str(msg))
+ print "Can't remove local file %r: %s" % (fullname, msg)
return 0
return 1
@@ -394,7 +386,7 @@ def writedict(dict, filename):
fp = open(tempname, 'w')
fp.write('{\n')
for key, value in dict.items():
- fp.write('%s: %s,\n' % (`key`, `value`))
+ fp.write('%r: %r,\n' % (key, value))
fp.write('}\n')
fp.close()
try:
diff --git a/Tools/scripts/methfix.py b/Tools/scripts/methfix.py
index 9e69961..9200d265 100755
--- a/Tools/scripts/methfix.py
+++ b/Tools/scripts/methfix.py
@@ -55,12 +55,12 @@ def ispython(name):
return ispythonprog.match(name) >= 0
def recursedown(dirname):
- dbg('recursedown(' + `dirname` + ')\n')
+ dbg('recursedown(%r)\n' % (dirname,))
bad = 0
try:
names = os.listdir(dirname)
except os.error, msg:
- err(dirname + ': cannot list directory: ' + `msg` + '\n')
+ err('%s: cannot list directory: %r\n' % (dirname, msg))
return 1
names.sort()
subdirs = []
@@ -77,11 +77,11 @@ def recursedown(dirname):
return bad
def fix(filename):
-## dbg('fix(' + `filename` + ')\n')
+## dbg('fix(%r)\n' % (filename,))
try:
f = open(filename, 'r')
except IOError, msg:
- err(filename + ': cannot open: ' + `msg` + '\n')
+ err('%s: cannot open: %r\n' % (filename, msg))
return 1
head, tail = os.path.split(filename)
tempname = os.path.join(head, '@' + tail)
@@ -119,14 +119,13 @@ def fix(filename):
g = open(tempname, 'w')
except IOError, msg:
f.close()
- err(tempname+': cannot create: '+\
- `msg`+'\n')
+ err('%s: cannot create: %r\n' % (tempname, msg))
return 1
f.seek(0)
lineno = 0
rep(filename + ':\n')
continue # restart from the beginning
- rep(`lineno` + '\n')
+ rep(repr(lineno) + '\n')
rep('< ' + line)
rep('> ' + newline)
if g is not None:
@@ -143,17 +142,17 @@ def fix(filename):
statbuf = os.stat(filename)
os.chmod(tempname, statbuf[ST_MODE] & 07777)
except os.error, msg:
- err(tempname + ': warning: chmod failed (' + `msg` + ')\n')
+ err('%s: warning: chmod failed (%r)\n' % (tempname, msg))
# Then make a backup of the original file as filename~
try:
os.rename(filename, filename + '~')
except os.error, msg:
- err(filename + ': warning: backup failed (' + `msg` + ')\n')
+ err('%s: warning: backup failed (%r)\n' % (filename, msg))
# Now move the temp file to the original file
try:
os.rename(tempname, filename)
except os.error, msg:
- err(filename + ': rename failed (' + `msg` + ')\n')
+ err('%s: rename failed (%r)\n' % (filename, msg))
return 1
# Return succes
return 0
diff --git a/Tools/scripts/pathfix.py b/Tools/scripts/pathfix.py
index 81c5a6e..47ae464 100755
--- a/Tools/scripts/pathfix.py
+++ b/Tools/scripts/pathfix.py
@@ -64,12 +64,12 @@ def ispython(name):
return ispythonprog.match(name) >= 0
def recursedown(dirname):
- dbg('recursedown(' + `dirname` + ')\n')
+ dbg('recursedown(%r)\n' % (dirname,))
bad = 0
try:
names = os.listdir(dirname)
except os.error, msg:
- err(dirname + ': cannot list directory: ' + `msg` + '\n')
+ err('%s: cannot list directory: %r\n' % (dirname, msg))
return 1
names.sort()
subdirs = []
@@ -86,11 +86,11 @@ def recursedown(dirname):
return bad
def fix(filename):
-## dbg('fix(' + `filename` + ')\n')
+## dbg('fix(%r)\n' % (filename,))
try:
f = open(filename, 'r')
except IOError, msg:
- err(filename + ': cannot open: ' + `msg` + '\n')
+ err('%s: cannot open: %r\n' % (filename, msg))
return 1
line = f.readline()
fixed = fixline(line)
@@ -104,7 +104,7 @@ def fix(filename):
g = open(tempname, 'w')
except IOError, msg:
f.close()
- err(tempname+': cannot create: '+`msg`+'\n')
+ err('%s: cannot create: %r\n' % (tempname, msg))
return 1
rep(filename + ': updating\n')
g.write(fixed)
@@ -123,17 +123,17 @@ def fix(filename):
statbuf = os.stat(filename)
os.chmod(tempname, statbuf[ST_MODE] & 07777)
except os.error, msg:
- err(tempname + ': warning: chmod failed (' + `msg` + ')\n')
+ err('%s: warning: chmod failed (%r)\n' % (tempname, msg))
# Then make a backup of the original file as filename~
try:
os.rename(filename, filename + '~')
except os.error, msg:
- err(filename + ': warning: backup failed (' + `msg` + ')\n')
+ err('%s: warning: backup failed (%r)\n' % (filename, msg))
# Now move the temp file to the original file
try:
os.rename(tempname, filename)
except os.error, msg:
- err(filename + ': rename failed (' + `msg` + ')\n')
+ err('%s: rename failed (%r)\n' % (filename, msg))
return 1
# Return succes
return 0
diff --git a/Tools/scripts/redemo.py b/Tools/scripts/redemo.py
index 1eed8f8..de7f3c4 100644
--- a/Tools/scripts/redemo.py
+++ b/Tools/scripts/redemo.py
@@ -146,7 +146,7 @@ class ReDemo:
groups = list(m.groups())
groups.insert(0, m.group())
for i in range(len(groups)):
- g = "%2d: %s" % (i, `groups[i]`)
+ g = "%2d: %r" % (i, groups[i])
self.grouplist.insert(END, g)
nmatches = nmatches + 1
if self.showvar.get() == "first":
diff --git a/Tools/scripts/suff.py b/Tools/scripts/suff.py
index ee7499f..dfb3da0 100755
--- a/Tools/scripts/suff.py
+++ b/Tools/scripts/suff.py
@@ -17,7 +17,7 @@ def main():
keys = suffixes.keys()
keys.sort()
for suff in keys:
- print `suff`, len(suffixes[suff])
+ print repr(suff), len(suffixes[suff])
def getsuffix(filename):
suff = ''
diff --git a/Tools/scripts/texi2html.py b/Tools/scripts/texi2html.py
index b91a53d..1d9a21a 100755
--- a/Tools/scripts/texi2html.py
+++ b/Tools/scripts/texi2html.py
@@ -257,7 +257,7 @@ class TexinfoParser:
line = fp.readline()
lineno = lineno + 1
if line[:len(MAGIC)] <> MAGIC:
- raise SyntaxError, 'file does not begin with '+`MAGIC`
+ raise SyntaxError, 'file does not begin with %r' % (MAGIC,)
self.parserest(fp, lineno)
# Parse the contents of a file, not expecting a MAGIC header
@@ -475,7 +475,7 @@ class TexinfoParser:
continue
if c <> '@':
# Cannot happen unless spprog is changed
- raise RuntimeError, 'unexpected funny '+`c`
+ raise RuntimeError, 'unexpected funny %r' % c
start = i
while i < n and text[i] in string.ascii_letters: i = i+1
if i == start:
@@ -555,9 +555,9 @@ class TexinfoParser:
try:
fp = open(file, 'r')
except IOError, msg:
- print '*** Can\'t open include file', `file`
+ print '*** Can\'t open include file', repr(file)
return
- print '!'*self.debugging, '--> file', `file`
+ print '!'*self.debugging, '--> file', repr(file)
save_done = self.done
save_skip = self.skip
save_stack = self.stack
@@ -568,7 +568,7 @@ class TexinfoParser:
self.done = save_done
self.skip = save_skip
self.stack = save_stack
- print '!'*self.debugging, '<-- file', `file`
+ print '!'*self.debugging, '<-- file', repr(file)
# --- Special Insertions ---
@@ -806,7 +806,7 @@ class TexinfoParser:
# if self.savetext <> None:
# print '*** Recursive footnote -- expect weirdness'
id = len(self.footnotes) + 1
- self.write(self.FN_SOURCE_PATTERN % {'id': `id`})
+ self.write(self.FN_SOURCE_PATTERN % {'id': repr(id))
self.startsaving()
def close_footnote(self):
@@ -817,7 +817,7 @@ class TexinfoParser:
self.write(self.FN_HEADER)
for id, text in self.footnotes:
self.write(self.FN_TARGET_PATTERN
- % {'id': `id`, 'text': text})
+ % {'id': repr(id), 'text': text})
self.footnotes = []
def open_file(self): self.write('<CODE>')
@@ -1162,7 +1162,7 @@ class TexinfoParser:
self.numbering[level] = self.numbering[level] + 1
x = ''
for i in self.numbering:
- x = x + `i` + '.'
+ x = x + repr(i) + '.'
args = x + ' ' + args
self.contents.append((level, args, self.nodename))
self.write('<', type, '>')
@@ -1549,7 +1549,7 @@ class TexinfoParser:
if self.whichindex.has_key(name):
self.index(name, args)
else:
- print '*** No index named', `name`
+ print '*** No index named', repr(name)
def do_cindex(self, args): self.index('cp', args)
def do_findex(self, args): self.index('fn', args)
@@ -1585,7 +1585,7 @@ class TexinfoParser:
if self.whichindex.has_key(name):
self.prindex(name)
else:
- print '*** No index named', `name`
+ print '*** No index named', repr(name)
def prindex(self, name):
iscodeindex = (name not in self.noncodeindices)
diff --git a/Tools/scripts/untabify.py b/Tools/scripts/untabify.py
index 17e9166..9bdf235 100755
--- a/Tools/scripts/untabify.py
+++ b/Tools/scripts/untabify.py
@@ -29,7 +29,7 @@ def process(filename, tabsize):
text = f.read()
f.close()
except IOError, msg:
- print "%s: I/O error: %s" % (`filename`, str(msg))
+ print "%r: I/O error: %s" % (filename, msg)
return
newtext = text.expandtabs(tabsize)
if newtext == text:
diff --git a/Tools/scripts/which.py b/Tools/scripts/which.py
index 2182546..7b3d2e0 100755
--- a/Tools/scripts/which.py
+++ b/Tools/scripts/which.py
@@ -48,7 +48,7 @@ for prog in sys.argv[1:]:
msg(filename + ': not executable')
if longlist:
sts = os.system('ls ' + longlist + ' ' + filename)
- if sts: msg('"ls -l" exit status: ' + `sts`)
+ if sts: msg('"ls -l" exit status: ' + repr(sts))
if not ident:
msg(prog + ': not found')
sts = 1