aboutsummaryrefslogtreecommitdiff
path: root/scripts/maint/sortChanges.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/maint/sortChanges.py')
-rwxr-xr-xscripts/maint/sortChanges.py17
1 files changed, 11 insertions, 6 deletions
diff --git a/scripts/maint/sortChanges.py b/scripts/maint/sortChanges.py
index 986b94b025..5f6324e387 100755
--- a/scripts/maint/sortChanges.py
+++ b/scripts/maint/sortChanges.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/env python
# Copyright (c) 2014-2019, The Tor Project, Inc.
# See LICENSE for licensing information
@@ -7,6 +7,11 @@
changelog.
"""
+# Future imports for Python 2.7, mandatory in 3.0
+from __future__ import division
+from __future__ import print_function
+from __future__ import unicode_literals
+
import re
import sys
@@ -43,7 +48,7 @@ REPLACEMENTS = {
def score(s,fname=None):
m = re.match(r'^ +o ([^\n]*)\n(.*)', s, re.M|re.S)
if not m:
- print >>sys.stderr, "Can't score %r from %s"%(s,fname)
+ print("Can't score %r from %s"%(s,fname), file=sys.stderr)
heading = m.group(1)
heading = REPLACEMENTS.get(heading, heading)
lw = m.group(1).lower()
@@ -100,9 +105,9 @@ changes.sort()
last_lw = "this is not a header"
for _, lw, header, rest in changes:
if lw == last_lw:
- print rest,
+ print(rest, end="")
else:
- print
- print " o",header
- print rest,
+ print()
+ print(" o",header)
+ print(rest, end="")
last_lw = lw