Commit 6247fdbf authored by Guido van Rossum's avatar Guido van Rossum

Fix print syntax so this runs using 3.0.

parent 4a76da79
...@@ -45,8 +45,8 @@ dryrun = 0 ...@@ -45,8 +45,8 @@ dryrun = 0
def usage(msg=None): def usage(msg=None):
if msg is not None: if msg is not None:
print >> sys.stderr, msg print(msg, file=sys.stderr)
print >> sys.stderr, __doc__ print(__doc__, file=sys.stderr)
def errprint(*args): def errprint(*args):
sep = "" sep = ""
...@@ -85,7 +85,7 @@ def main(): ...@@ -85,7 +85,7 @@ def main():
def check(file): def check(file):
if os.path.isdir(file) and not os.path.islink(file): if os.path.isdir(file) and not os.path.islink(file):
if verbose: if verbose:
print "listing directory", file print("listing directory", file)
names = os.listdir(file) names = os.listdir(file)
for name in names: for name in names:
fullname = os.path.join(file, name) fullname = os.path.join(file, name)
...@@ -96,7 +96,7 @@ def check(file): ...@@ -96,7 +96,7 @@ def check(file):
return return
if verbose: if verbose:
print "checking", file, "...", print("checking", file, "...", end=' ')
try: try:
f = open(file) f = open(file)
except IOError as msg: except IOError as msg:
...@@ -107,24 +107,24 @@ def check(file): ...@@ -107,24 +107,24 @@ def check(file):
f.close() f.close()
if r.run(): if r.run():
if verbose: if verbose:
print "changed." print("changed.")
if dryrun: if dryrun:
print "But this is a dry run, so leaving it alone." print("But this is a dry run, so leaving it alone.")
if not dryrun: if not dryrun:
bak = file + ".bak" bak = file + ".bak"
if os.path.exists(bak): if os.path.exists(bak):
os.remove(bak) os.remove(bak)
os.rename(file, bak) os.rename(file, bak)
if verbose: if verbose:
print "renamed", file, "to", bak print("renamed", file, "to", bak)
f = open(file, "w") f = open(file, "w")
r.write(f) r.write(f)
f.close() f.close()
if verbose: if verbose:
print "wrote new", file print("wrote new", file)
else: else:
if verbose: if verbose:
print "unchanged." print("unchanged.")
def _rstrip(line, JUNK='\n \t'): def _rstrip(line, JUNK='\n \t'):
"""Return line stripped of trailing spaces, tabs, newlines. """Return line stripped of trailing spaces, tabs, newlines.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment