aboutsummaryrefslogtreecommitdiff
path: root/scripts/maint
diff options
context:
space:
mode:
authorcclauss <cclauss@me.com>2020-01-28 01:38:54 +0100
committercclauss <cclauss@me.com>2020-01-28 01:38:54 +0100
commit3208a74f906c116e93074c6ed0559df1cbfe58d1 (patch)
treec43d03841d5c29d4a8fc29793ef71eebc065d989 /scripts/maint
parentaba31e2187808257b250bf469895330f273d7746 (diff)
downloadtor-3208a74f906c116e93074c6ed0559df1cbfe58d1.tar.gz
tor-3208a74f906c116e93074c6ed0559df1cbfe58d1.zip
Use print() function in both Python 2 and Python 3
Diffstat (limited to 'scripts/maint')
-rwxr-xr-xscripts/maint/format_changelog.py2
-rwxr-xr-xscripts/maint/locatemissingdoxygen.py6
-rwxr-xr-xscripts/maint/redox.py17
3 files changed, 15 insertions, 10 deletions
diff --git a/scripts/maint/format_changelog.py b/scripts/maint/format_changelog.py
index 5f04a44ef6..32085c3602 100755
--- a/scripts/maint/format_changelog.py
+++ b/scripts/maint/format_changelog.py
@@ -291,7 +291,7 @@ class ChangeLog(object):
self.curgraf.append(line)
else:
- assert "This" is "unreachable"
+ assert "This" is "unreachable" # noqa: F632
def lint_head(self, line, head):
m = re.match(r'^ *o ([^\(]+)((?:\([^\)]+\))?):', head)
diff --git a/scripts/maint/locatemissingdoxygen.py b/scripts/maint/locatemissingdoxygen.py
index 9e58bd3477..7733977359 100755
--- a/scripts/maint/locatemissingdoxygen.py
+++ b/scripts/maint/locatemissingdoxygen.py
@@ -34,10 +34,10 @@ def buildWarnings():
def count(fn):
if os.path.abspath(fn) not in warnings:
- print "0\t%s"%fn
+ print("0\t%s"%fn)
else:
n = len(warnings[os.path.abspath(fn)])
- print "%d\t%s"%(n,fn)
+ print("%d\t%s"%(n,fn))
def getIndentation(line):
s = line.lstrip()
@@ -67,7 +67,7 @@ def annotate(filename):
if __name__ == '__main__':
if len(sys.argv) == 1:
- print "Usage: locatemissingdoxygen.py [-A] filename... <doxygen_log"
+ print("Usage: locatemissingdoxygen.py [-A] filename... <doxygen_log")
sys.exit(1)
buildWarnings()
if sys.argv[1] == '-A':
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)