Replace backticks with repr() or "%r"

From SF patch #852334.
This commit is contained in:
Walter Dörwald 2004-02-12 17:35:32 +00:00
parent ecfeb7f095
commit 70a6b49821
246 changed files with 926 additions and 962 deletions

View file

@ -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: