mirror of
https://github.com/python/cpython.git
synced 2025-07-12 13:55:34 +00:00
Fix most trivially-findable print statements.
There's one major and one minor category still unfixed: doctests are the major category (and I hope to be able to augment the refactoring tool to refactor bona fide doctests soon); other code generating print statements in strings is the minor category. (Oh, and I don't know if the compiler package works.)
This commit is contained in:
parent
452bf519a7
commit
be19ed77dd
331 changed files with 2567 additions and 2648 deletions
|
@ -33,11 +33,11 @@ def compile_dir(dir, maxlevels=10, ddir=None,
|
|||
|
||||
"""
|
||||
if not quiet:
|
||||
print 'Listing', dir, '...'
|
||||
print('Listing', dir, '...')
|
||||
try:
|
||||
names = os.listdir(dir)
|
||||
except os.error:
|
||||
print "Can't list", dir
|
||||
print("Can't list", dir)
|
||||
names = []
|
||||
names.sort()
|
||||
success = 1
|
||||
|
@ -60,18 +60,18 @@ def compile_dir(dir, maxlevels=10, ddir=None,
|
|||
except os.error: ctime = 0
|
||||
if (ctime > ftime) and not force: continue
|
||||
if not quiet:
|
||||
print 'Compiling', fullname, '...'
|
||||
print('Compiling', fullname, '...')
|
||||
try:
|
||||
ok = py_compile.compile(fullname, None, dfile, True)
|
||||
except KeyboardInterrupt:
|
||||
raise KeyboardInterrupt
|
||||
except py_compile.PyCompileError as err:
|
||||
if quiet:
|
||||
print 'Compiling', fullname, '...'
|
||||
print err.msg
|
||||
print('Compiling', fullname, '...')
|
||||
print(err.msg)
|
||||
success = 0
|
||||
except IOError as e:
|
||||
print "Sorry", e
|
||||
print("Sorry", e)
|
||||
success = 0
|
||||
else:
|
||||
if ok == 0:
|
||||
|
@ -98,7 +98,7 @@ def compile_path(skip_curdir=1, maxlevels=0, force=0, quiet=0):
|
|||
success = 1
|
||||
for dir in sys.path:
|
||||
if (not dir or dir == os.curdir) and skip_curdir:
|
||||
print 'Skipping current directory'
|
||||
print('Skipping current directory')
|
||||
else:
|
||||
success = success and compile_dir(dir, maxlevels, None,
|
||||
force, quiet=quiet)
|
||||
|
@ -110,16 +110,16 @@ def main():
|
|||
try:
|
||||
opts, args = getopt.getopt(sys.argv[1:], 'lfqd:x:')
|
||||
except getopt.error as msg:
|
||||
print msg
|
||||
print "usage: python compileall.py [-l] [-f] [-q] [-d destdir] " \
|
||||
"[-x regexp] [directory ...]"
|
||||
print "-l: don't recurse down"
|
||||
print "-f: force rebuild even if timestamps are up-to-date"
|
||||
print "-q: quiet operation"
|
||||
print "-d destdir: purported directory name for error messages"
|
||||
print " if no directory arguments, -l sys.path is assumed"
|
||||
print "-x regexp: skip files matching the regular expression regexp"
|
||||
print " the regexp is search for in the full path of the file"
|
||||
print(msg)
|
||||
print("usage: python compileall.py [-l] [-f] [-q] [-d destdir] " \
|
||||
"[-x regexp] [directory ...]")
|
||||
print("-l: don't recurse down")
|
||||
print("-f: force rebuild even if timestamps are up-to-date")
|
||||
print("-q: quiet operation")
|
||||
print("-d destdir: purported directory name for error messages")
|
||||
print(" if no directory arguments, -l sys.path is assumed")
|
||||
print("-x regexp: skip files matching the regular expression regexp")
|
||||
print(" the regexp is search for in the full path of the file")
|
||||
sys.exit(2)
|
||||
maxlevels = 10
|
||||
ddir = None
|
||||
|
@ -136,7 +136,7 @@ def main():
|
|||
rx = re.compile(a)
|
||||
if ddir:
|
||||
if len(args) != 1:
|
||||
print "-d destdir require exactly one directory argument"
|
||||
print("-d destdir require exactly one directory argument")
|
||||
sys.exit(2)
|
||||
success = 1
|
||||
try:
|
||||
|
@ -148,7 +148,7 @@ def main():
|
|||
else:
|
||||
success = compile_path()
|
||||
except KeyboardInterrupt:
|
||||
print "\n[interrupt]"
|
||||
print("\n[interrupt]")
|
||||
success = 0
|
||||
return success
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue