diff options
author | cclauss <cclauss@me.com> | 2020-01-28 01:38:54 +0100 |
---|---|---|
committer | cclauss <cclauss@me.com> | 2020-01-28 01:38:54 +0100 |
commit | 3208a74f906c116e93074c6ed0559df1cbfe58d1 (patch) | |
tree | c43d03841d5c29d4a8fc29793ef71eebc065d989 /scripts/maint/redox.py | |
parent | aba31e2187808257b250bf469895330f273d7746 (diff) | |
download | tor-3208a74f906c116e93074c6ed0559df1cbfe58d1.tar.gz tor-3208a74f906c116e93074c6ed0559df1cbfe58d1.zip |
Use print() function in both Python 2 and Python 3
Diffstat (limited to 'scripts/maint/redox.py')
-rwxr-xr-x | scripts/maint/redox.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/scripts/maint/redox.py b/scripts/maint/redox.py index 171c6d9699..3ad3e3f1b8 100755 --- a/scripts/maint/redox.py +++ b/scripts/maint/redox.py @@ -37,6 +37,11 @@ from __future__ import unicode_literals import re import sys +try: + xrange # Python 2 +except NameError: + xrange = range # Python 3 + # Which files should we ignore warning from? Mostly, these are external # files that we've snarfed in from somebody else, whose C we do no intend # to document for them. @@ -78,7 +83,7 @@ def parsething(thing): else: m = THING_RE.match(thing) if not m: - print thing, "???? Format didn't match." + print(thing, "???? Format didn't match.") return None, None else: name, tp, parent = m.groups() @@ -155,7 +160,7 @@ def checkf(fn, errs): """ for skip in SKIP_FILES: if fn.endswith(skip): - print "Skipping",fn + print("Skipping",fn) return comments = [] @@ -174,8 +179,8 @@ def checkf(fn, errs): ln = findline(lines, line, name) if ln == None: - print "Couldn't find the definition of %s allegedly on %s of %s"%( - name, line, fn) + print("Couldn't find the definition of %s allegedly on %s of %s"%( + name, line, fn)) else: if hasdocdoc(lines, line, kind): # print "Has a DOCDOC" @@ -220,12 +225,12 @@ def applyComments(fn, entries): outf.write(line) outf.close() - print "Added %s DOCDOCs to %s" %(N, fn) + print("Added %s DOCDOCs to %s" %(N, fn)) e = read() for fn, errs in e.iteritems(): - print `(fn, errs)` + print(repr((fn, errs))) comments = checkf(fn, errs) if comments: applyComments(fn, comments) |