Skip to content

Commit 6247fdb

Browse files
committed
Fix print syntax so this runs using 3.0.
1 parent 4a76da7 commit 6247fdb

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

Tools/scripts/reindent.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@
4545

4646
def usage(msg=None):
4747
if msg is not None:
48-
print >> sys.stderr, msg
49-
print >> sys.stderr, __doc__
48+
print(msg, file=sys.stderr)
49+
print(__doc__, file=sys.stderr)
5050

5151
def errprint(*args):
5252
sep = ""
@@ -85,7 +85,7 @@ def main():
8585
def check(file):
8686
if os.path.isdir(file) and not os.path.islink(file):
8787
if verbose:
88-
print "listing directory", file
88+
print("listing directory", file)
8989
names = os.listdir(file)
9090
for name in names:
9191
fullname = os.path.join(file, name)
@@ -96,7 +96,7 @@ def check(file):
9696
return
9797

9898
if verbose:
99-
print "checking", file, "...",
99+
print("checking", file, "...", end=' ')
100100
try:
101101
f = open(file)
102102
except IOError as msg:
@@ -107,24 +107,24 @@ def check(file):
107107
f.close()
108108
if r.run():
109109
if verbose:
110-
print "changed."
110+
print("changed.")
111111
if dryrun:
112-
print "But this is a dry run, so leaving it alone."
112+
print("But this is a dry run, so leaving it alone.")
113113
if not dryrun:
114114
bak = file + ".bak"
115115
if os.path.exists(bak):
116116
os.remove(bak)
117117
os.rename(file, bak)
118118
if verbose:
119-
print "renamed", file, "to", bak
119+
print("renamed", file, "to", bak)
120120
f = open(file, "w")
121121
r.write(f)
122122
f.close()
123123
if verbose:
124-
print "wrote new", file
124+
print("wrote new", file)
125125
else:
126126
if verbose:
127-
print "unchanged."
127+
print("unchanged.")
128128

129129
def _rstrip(line, JUNK='\n \t'):
130130
"""Return line stripped of trailing spaces, tabs, newlines.

0 commit comments

Comments
 (0)