Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/gdb-pre7.0/mono-gdb.py41
-rw-r--r--data/gdb-pre7.0/test-xdb.py4
-rw-r--r--data/gdb/mono-gdb.py63
-rw-r--r--data/gdb/test-xdb.py4
-rwxr-xr-xmono/tests/gc-descriptors/gen-descriptor-tests.py49
-rwxr-xr-xscripts/commits-to-changelog.py37
6 files changed, 102 insertions, 96 deletions
diff --git a/data/gdb-pre7.0/mono-gdb.py b/data/gdb-pre7.0/mono-gdb.py
index c360d658f6a..1c013e38611 100644
--- a/data/gdb-pre7.0/mono-gdb.py
+++ b/data/gdb-pre7.0/mono-gdb.py
@@ -15,6 +15,7 @@
# When attaching to a mono process, make sure you are in the same directory.
#
+from __future__ import print_function
import os
class StringPrinter:
@@ -35,7 +36,7 @@ class StringPrinter:
while i < len:
val = (chars.cast(gdb.lookup_type ("gint64")) + (i * 2)).cast(gdb.lookup_type ("gunichar2").pointer ()).dereference ()
if val >= 256:
- c = "\u%X" % val
+ c = "\u%X".format (val)
else:
c = chr (val)
res.append (c)
@@ -52,7 +53,7 @@ def stringify_class_name(ns, name):
if ns == "":
return name
else:
- return "%s.%s" % (ns, name)
+ return "%s.%s".format (ns, name)
class ArrayPrinter:
"Print a C# array"
@@ -65,7 +66,7 @@ class ArrayPrinter:
def to_string(self):
obj = self.val.cast (gdb.lookup_type ("MonoArray").pointer ()).dereference ()
length = obj ['max_length']
- return "%s [%d]" % (stringify_class_name (self.class_ns, self.class_name [0:len(self.class_name) - 2]), int(length))
+ return "%s [%d]".format (stringify_class_name (self.class_ns, self.class_name [0:len (self.class_name) - 2]), int (length))
class ObjectPrinter:
"Print a C# object"
@@ -95,7 +96,7 @@ class ObjectPrinter:
return (field.name, self.obj [field.name])
except:
# Superclass
- return (field.name, self.obj.cast (gdb.lookup_type ("%s" % (field.name))))
+ return (field.name, self.obj.cast (gdb.lookup_type ("%s".format (field.name))))
def children(self):
# FIXME: It would be easier if gdb.Value would support iteration itself
@@ -108,11 +109,11 @@ class ObjectPrinter:
class_name = obj ['vtable'].dereference ()['klass'].dereference ()['name'].string ()
if class_name [-2:len(class_name)] == "[]":
return {}.__iter__ ()
- gdb_type = gdb.lookup_type ("struct %s_%s" % (class_ns.replace (".", "_"), class_name))
+ gdb_type = gdb.lookup_type ("struct %s_%s".format (class_ns.replace (".", "_"), class_name))
return self._iterator(obj.cast (gdb_type))
except:
- print sys.exc_info ()[0]
- print sys.exc_info ()[1]
+ print (sys.exc_info ()[0])
+ print (sys.exc_info ()[1])
return {}.__iter__ ()
def to_string(self):
@@ -128,16 +129,16 @@ class ObjectPrinter:
return ArrayPrinter (self.val,class_ns,class_name).to_string ()
if class_ns != "":
try:
- gdb_type = gdb.lookup_type ("struct %s.%s" % (class_ns, class_name))
+ gdb_type = gdb.lookup_type ("struct %s.%s".format (class_ns, class_name))
except:
# Maybe there is no debug info for that type
- return "%s.%s" % (class_ns, class_name)
+ return "%s.%s".format (class_ns, class_name)
#return obj.cast (gdb_type)
- return "%s.%s" % (class_ns, class_name)
+ return "%s.%s".format (class_ns, class_name)
return class_name
except:
- print sys.exc_info ()[0]
- print sys.exc_info ()[1]
+ print (sys.exc_info ()[0])
+ print (sys.exc_info ()[1])
# FIXME: This can happen because we don't have liveness information
return self.val.cast (gdb.lookup_type ("guint64"))
@@ -153,9 +154,9 @@ class MonoMethodPrinter:
val = self.val.dereference ()
klass = val ["klass"].dereference ()
class_name = stringify_class_name (klass ["name_space"].string (), klass ["name"].string ())
- return "\"%s:%s ()\"" % (class_name, val ["name"].string ())
+ return "\"%s:%s ()\"".format (class_name, val ["name"].string ())
# This returns more info but requires calling into the inferior
- #return "\"%s\"" % (gdb.parse_and_eval ("mono_method_full_name (%s, 1)" % (str (int (self.val.cast (gdb.lookup_type ("guint64")))))).string ())
+ #return "\"%s\"".format (gdb.parse_and_eval ("mono_method_full_name (%s, 1)".format (str (int (self.val.cast (gdb.lookup_type ("guint64")))))).string ())
class MonoClassPrinter:
"Print a MonoClass structure"
@@ -168,9 +169,9 @@ class MonoClassPrinter:
return "0x0"
klass = self.val.dereference ()
class_name = stringify_class_name (klass ["name_space"].string (), klass ["name"].string ())
- return "\"%s\"" % (class_name)
+ return "\"%s\"".format (class_name)
# This returns more info but requires calling into the inferior
- #return "\"%s\"" % (gdb.parse_and_eval ("mono_type_full_name (&((MonoClass*)%s)->byval_arg)" % (str (int ((self.val).cast (gdb.lookup_type ("guint64")))))))
+ #return "\"%s\"".format (gdb.parse_and_eval ("mono_type_full_name (&((MonoClass*)%s)->byval_arg)".format (str (int ((self.val).cast (gdb.lookup_type ("guint64")))))))
def lookup_pretty_printer(val):
t = str (val.type)
@@ -216,9 +217,9 @@ class MonoSupport(object):
new_size = os.stat ("xdb.s").st_size
if new_size > self.s_size:
sofile = "xdb.so"
- gdb.execute ("shell as -o xdb.o xdb.s && ld -shared -o %s xdb.o" % sofile)
+ gdb.execute ("shell as -o xdb.o xdb.s && ld -shared -o %s xdb.o".format (sofile))
# FIXME: This prints messages which couldn't be turned off
- gdb.execute ("add-symbol-file %s 0" % sofile)
+ gdb.execute ("add-symbol-file %s 0".format (sofile))
self.s_size = new_size
class RunHook (gdb.Command):
@@ -229,7 +230,7 @@ class RunHook (gdb.Command):
def invoke(self, arg, from_tty):
mono_support.run_hook ()
-print "Mono support loaded."
+print ("Mono support loaded.")
mono_support = MonoSupport ()
@@ -244,4 +245,4 @@ exec_file = gdb.current_objfile ().filename
if os.stat (exec_file).st_size != os.lstat (exec_file).st_size:
exec_file = os.readlink (exec_file)
exec_dir = os.path.dirname (exec_file)
-gdb.execute ("source %s/%s-gdbinit" % (exec_dir, os.path.basename (exec_file)))
+gdb.execute ("source %s/%s-gdbinit".format (exec_dir, os.path.basename (exec_file)))
diff --git a/data/gdb-pre7.0/test-xdb.py b/data/gdb-pre7.0/test-xdb.py
index a78a998e769..b60c4a2f1e8 100644
--- a/data/gdb-pre7.0/test-xdb.py
+++ b/data/gdb-pre7.0/test-xdb.py
@@ -3,8 +3,8 @@
import sys
-gdb.execute ("file %s" % sys.argv [0])
-gdb.execute ("r --break *:* %s" % " ".join (sys.argv[1:len(sys.argv)]))
+gdb.execute ("file %s".format (sys.argv [0]))
+gdb.execute ("r --break *:* %s".format (" ".join (sys.argv [1:len (sys.argv)])))
while True:
try:
diff --git a/data/gdb/mono-gdb.py b/data/gdb/mono-gdb.py
index c8d921ebd38..ce34d357f64 100644
--- a/data/gdb/mono-gdb.py
+++ b/data/gdb/mono-gdb.py
@@ -10,6 +10,7 @@
# - run mono under gdb, or attach to a mono process started with --debug=gdb using gdb.
#
+from __future__ import print_function
import os
class StringPrinter:
@@ -30,7 +31,7 @@ class StringPrinter:
while i < len:
val = (chars.cast(gdb.lookup_type ("gint64")) + (i * 2)).cast(gdb.lookup_type ("gunichar2").pointer ()).dereference ()
if val >= 256:
- c = "\u%X" % val
+ c = "\u%X".format (val)
else:
c = chr (val)
res.append (c)
@@ -47,7 +48,7 @@ def stringify_class_name(ns, name):
if ns == "":
return name
else:
- return "%s.%s" % (ns, name)
+ return "%s.%s".format (ns, name)
class ArrayPrinter:
"Print a C# array"
@@ -60,7 +61,7 @@ class ArrayPrinter:
def to_string(self):
obj = self.val.cast (gdb.lookup_type ("MonoArray").pointer ()).dereference ()
length = obj ['max_length']
- return "%s [%d]" % (stringify_class_name (self.class_ns, self.class_name [0:len(self.class_name) - 2]), int(length))
+ return "%s [%d]".format (stringify_class_name (self.class_ns, self.class_name [0:len(self.class_name) - 2]), int(length))
class ObjectPrinter:
"Print a C# object"
@@ -90,7 +91,7 @@ class ObjectPrinter:
return (field.name, self.obj [field.name])
except:
# Superclass
- return (field.name, self.obj.cast (gdb.lookup_type ("%s" % (field.name))))
+ return (field.name, self.obj.cast (gdb.lookup_type ("%s".format (field.name))))
def children(self):
# FIXME: It would be easier if gdb.Value would support iteration itself
@@ -104,13 +105,13 @@ class ObjectPrinter:
if class_name [-2:len(class_name)] == "[]":
return {}.__iter__ ()
try:
- gdb_type = gdb.lookup_type ("struct %s_%s" % (class_ns.replace (".", "_"), class_name))
+ gdb_type = gdb.lookup_type ("struct %s_%s".format (class_ns.replace (".", "_"), class_name))
return self._iterator(obj.cast (gdb_type))
except:
return {}.__iter__ ()
except:
- print sys.exc_info ()[0]
- print sys.exc_info ()[1]
+ print (sys.exc_info ()[0])
+ print (sys.exc_info ()[1])
return {}.__iter__ ()
def to_string(self):
@@ -126,16 +127,16 @@ class ObjectPrinter:
return ArrayPrinter (self.val,class_ns,class_name).to_string ()
if class_ns != "":
try:
- gdb_type = gdb.lookup_type ("struct %s.%s" % (class_ns, class_name))
+ gdb_type = gdb.lookup_type ("struct %s.%s".format (class_ns, class_name))
except:
# Maybe there is no debug info for that type
- return "%s.%s" % (class_ns, class_name)
+ return "%s.%s".format (class_ns, class_name)
#return obj.cast (gdb_type)
- return "%s.%s" % (class_ns, class_name)
+ return "%s.%s".format (class_ns, class_name)
return class_name
except:
- print sys.exc_info ()[0]
- print sys.exc_info ()[1]
+ print (sys.exc_info ()[0])
+ print (sys.exc_info ()[1])
# FIXME: This can happen because we don't have liveness information
return self.val.cast (gdb.lookup_type ("guint64"))
@@ -151,9 +152,9 @@ class MonoMethodPrinter:
val = self.val.dereference ()
klass = val ["klass"].dereference ()
class_name = stringify_class_name (klass ["name_space"].string (), klass ["name"].string ())
- return "\"%s:%s ()\"" % (class_name, val ["name"].string ())
+ return "\"%s:%s ()\"".format (class_name, val ["name"].string ())
# This returns more info but requires calling into the inferior
- #return "\"%s\"" % (gdb.parse_and_eval ("mono_method_full_name (%s, 1)" % (str (int (self.val.cast (gdb.lookup_type ("guint64")))))).string ())
+ #return "\"%s\"".format (gdb.parse_and_eval ("mono_method_full_name (%s, 1)".format (str (int (self.val.cast (gdb.lookup_type ("guint64")))))).string ())
class MonoClassPrinter:
"Print a MonoClass structure"
@@ -167,20 +168,20 @@ class MonoClassPrinter:
klass = self.val.dereference ()
class_name = stringify_class_name (klass ["name_space"].string (), klass ["name"].string ())
if klass ["generic_class"].cast (gdb.lookup_type ("guint64")) != 0:
- class_name = "%s<%s>" % (class_name, str (klass ["generic_class"]["context"]["class_inst"]))
+ class_name = "%s<%s>".format (class_name, str (klass ["generic_class"]["context"]["class_inst"]))
if add_quotes:
- return "\"%s\"" % (class_name)
+ return "\"%s\"".format (class_name)
else:
return class_name
# This returns more info but requires calling into the inferior
- #return "\"%s\"" % (gdb.parse_and_eval ("mono_type_full_name (&((MonoClass*)%s)->byval_arg)" % (str (int ((self.val).cast (gdb.lookup_type ("guint64")))))))
+ #return "\"%s\"".format (gdb.parse_and_eval ("mono_type_full_name (&((MonoClass*)%s)->byval_arg)".format (str (int ((self.val).cast (gdb.lookup_type ("guint64")))))))
def to_string(self):
try:
return self.to_string_inner (True)
except:
- #print sys.exc_info ()[0]
- #print sys.exc_info ()[1]
+ #print (sys.exc_info ()[0])
+ #print (sys.exc_info ()[1])
return str(self.val.cast (gdb.lookup_type ("gpointer")))
class MonoGenericInstPrinter:
@@ -197,7 +198,7 @@ class MonoGenericInstPrinter:
inst_args = inst ["type_argv"]
inst_str = ""
for i in range(0, inst_len):
- print inst_args
+ print (inst_args)
type_printer = MonoTypePrinter (inst_args [i])
if i > 0:
inst_str = inst_str + ", "
@@ -221,14 +222,14 @@ class MonoGenericClassPrinter:
method_inst_str = ""
if int(method_inst.cast (gdb.lookup_type ("guint64"))) != 0:
method_inst_str = str(method_inst)
- return "%s, [%s], [%s]>" % (container_str, class_inst_str, method_inst_str)
+ return "%s, [%s], [%s]>".format (container_str, class_inst_str, method_inst_str)
def to_string(self):
try:
return self.to_string_inner ()
except:
- #print sys.exc_info ()[0]
- #print sys.exc_info ()[1]
+ #print (sys.exc_info ()[0])
+ #print (sys.exc_info ()[1])
return str(self.val.cast (gdb.lookup_type ("gpointer")))
class MonoTypePrinter:
@@ -251,12 +252,12 @@ class MonoTypePrinter:
info = str(t ["data"]["generic_class"])
if info != "":
- return "{%s, %s}" % (kind, info)
+ return "{%s, %s}".format (kind, info)
else:
- return "{%s}" % (kind)
+ return "{%s}".format (kind)
except:
- #print sys.exc_info ()[0]
- #print sys.exc_info ()[1]
+ #print (sys.exc_info ()[0])
+ #print (sys.exc_info ()[1])
return str(self.val.cast (gdb.lookup_type ("gpointer")))
def to_string(self):
@@ -277,12 +278,12 @@ class MonoMethodRgctxPrinter:
inst_args = inst ["type_argv"]
inst_str = ""
for i in range(0, inst_len):
- print inst_args
+ print (inst_args)
type_printer = MonoTypePrinter (inst_args [i])
if i > 0:
inst_str = inst_str + ", "
inst_str = inst_str + type_printer.to_string ()
- return "MRGCTX[%s, [%s]]" % (klass_printer.to_string(), inst_str)
+ return "MRGCTX[%s, [%s]]".format (klass_printer.to_string(), inst_str)
class MonoVTablePrinter:
"Print a MonoVTable structure"
@@ -297,7 +298,7 @@ class MonoVTablePrinter:
klass = vtable ["klass"]
klass_printer = MonoClassPrinter (klass)
- return "vtable(%s)" % (klass_printer.to_string ())
+ return "vtable(%s)".format (klass_printer.to_string ())
def lookup_pretty_printer(val):
t = str (val.type)
@@ -348,6 +349,6 @@ XdbCommand ()
gdb.execute ("set environment MONO_XDEBUG gdb")
-print "Mono support loaded."
+print ("Mono support loaded.")
diff --git a/data/gdb/test-xdb.py b/data/gdb/test-xdb.py
index a78a998e769..b60c4a2f1e8 100644
--- a/data/gdb/test-xdb.py
+++ b/data/gdb/test-xdb.py
@@ -3,8 +3,8 @@
import sys
-gdb.execute ("file %s" % sys.argv [0])
-gdb.execute ("r --break *:* %s" % " ".join (sys.argv[1:len(sys.argv)]))
+gdb.execute ("file %s".format (sys.argv [0]))
+gdb.execute ("r --break *:* %s".format (" ".join (sys.argv [1:len (sys.argv)])))
while True:
try:
diff --git a/mono/tests/gc-descriptors/gen-descriptor-tests.py b/mono/tests/gc-descriptors/gen-descriptor-tests.py
index e2203780c77..4dc0e469a7f 100755
--- a/mono/tests/gc-descriptors/gen-descriptor-tests.py
+++ b/mono/tests/gc-descriptors/gen-descriptor-tests.py
@@ -1,6 +1,8 @@
#!/usr/bin/env python
+from __future__ import print_function
from optparse import OptionParser
+import sys
parser = OptionParser ()
parser.add_option ("--switch", action = "store_true", dest = "switch")
@@ -11,14 +13,15 @@ parser.add_option ("--one-method-if", action = "store_true", dest = "one_method_
def print_file (file_name):
f = open (file_name, "r")
for line in f:
- print (line),
+ sys.stdout.write (line + " ")
+ sys.stdout.flush ()
f.close ()
print_file ("descriptor-tests-prefix.cs")
print ("public struct NoRef1 { int x; }")
for i in range (1, 17):
- print ("public struct NoRef%d { NoRef%d a, b; }" % (1 << i, 1 << (i-1)))
+ print ("public struct NoRef{0} {{ NoRef{1} a, b; }}".format (1 << i, 1 << (i-1)))
print ("")
@@ -29,30 +32,30 @@ max_bitmap = 257
for offset in range (0, max_offset, 19):
for bitmap in range (0, max_bitmap):
- name = "Bitmap%dSkip%d" % (bitmap, offset)
+ name = "Bitmap{0}Skip{1}".format (bitmap, offset)
names.append (name)
- print ("public struct %s : Filler {" % name)
+ print ("public struct {0} : Filler {{".format (name))
for i in range (0, 16):
bit = 1 << i
if offset & bit:
- print (" NoRef%d skip%d;" % (bit, bit))
+ print (" NoRef{0} skip{1};".format (bit, bit))
for i in range (0, 9):
bit = 1 << i
if bitmap & bit:
- print (" object ref%d;" % i)
+ print (" object ref{0};".format (i))
else:
- print (" int bit%d;" % i)
+ print (" int bit{0};".format (i))
print (" public void Fill (object[] refs) {")
for i in range (0, 9):
bit = 1 << i
if bitmap & bit:
- print (" ref%d = refs [%d];" % (i, i))
+ print (" ref{0} = refs [{1}];".format (i, i))
print (" }")
print ("}")
- print ("public class %sWrapper : Filler {" % name)
- print (" %s[] a;" % name)
- print (" public %sWrapper () {" % name)
- print (" a = new %s [1];" % name)
+ print ("public class {0}Wrapper : Filler {{".format (name))
+ print (" {0}[] a;".format (name))
+ print (" public {0}Wrapper () {{".format (name))
+ print (" a = new {0} [1];".format (name))
print (" }")
print (" public void Fill (object[] refs) {")
print (" a [0].Fill (refs);")
@@ -60,14 +63,14 @@ for offset in range (0, max_offset, 19):
print ("}\n")
def search_method_name (left, right):
- return "MakeAndFillL%dR%d" % (left, right)
+ return "MakeAndFillL{0}R{1}".format (left, right)
def gen_new (name):
print ("Filler b;")
print ("if (wrap)")
- print (" b = new %sWrapper ();" % name)
+ print (" b = new {0}Wrapper ();".format (name))
print ("else")
- print (" b = new %s ();" % name)
+ print (" b = new {0} ();".format (name))
print ("b.Fill (refs); return b;")
def gen_binary_search_body (left, right, one_method):
@@ -75,21 +78,21 @@ def gen_binary_search_body (left, right, one_method):
gen_new (names [left])
else:
mid = (left + right) // 2
- print ("if (which < %d) {" % mid)
+ print ("if (which < {0}) {{".format (mid))
if one_method:
gen_binary_search_body (left, mid, one_method)
else:
- print ("return %s (which, refs, wrap);" % search_method_name (left, mid))
+ print ("return {0} (which, refs, wrap);".format (search_method_name (left, mid)))
print ("} else {")
if one_method:
gen_binary_search_body (mid, right, one_method)
else:
- print ("return %s (which, refs, wrap);" % search_method_name (mid, right))
+ print ("return {0} (which, refs, wrap);".format (search_method_name (mid, right)))
print ("}")
def gen_binary_search (left, right, one_method):
name = search_method_name (left, right)
- print ("public static Filler %s (int which, object[] refs, bool wrap) {" % name)
+ print ("public static Filler {0} (int which, object[] refs, bool wrap) {{".format (name))
gen_binary_search_body (left, right, one_method)
print ("}")
if not one_method and left + 1 < right:
@@ -103,7 +106,7 @@ if options.switch:
print (" public static Filler MakeAndFill (int which, object[] refs, bool wrap) {")
print (" switch (which) {")
for i in range (0, len (names)):
- print (" case %d: {" % i)
+ print (" case {0}: {{".format (i))
gen_new (names [i])
print ("}")
print (" default: return null;")
@@ -112,10 +115,10 @@ if options.switch:
else:
method_name = gen_binary_search (0, len (names), options.one_method_if)
print (" public static Filler MakeAndFill (int which, object[] refs, bool wrap) {")
- print (" if (which >= %d) return null;" % len (names))
- print (" return %s (which, refs, wrap);" % method_name)
+ print (" if (which >= {0}) return null;".format (len (names)))
+ print (" return {0} (which, refs, wrap);".format (method_name))
print (" }")
-print (" public const int NumWhich = %d;" % len (names))
+print (" public const int NumWhich = {0};".format (len (names)))
print ("}")
print ("")
diff --git a/scripts/commits-to-changelog.py b/scripts/commits-to-changelog.py
index bec87d9e582..6181c751ca9 100755
--- a/scripts/commits-to-changelog.py
+++ b/scripts/commits-to-changelog.py
@@ -1,5 +1,6 @@
#!/usr/bin/python
+from __future__ import print_function
from optparse import OptionParser
import subprocess
import re
@@ -19,7 +20,7 @@ def git (command, *args):
popen = subprocess.Popen (["git", command] + list (args), stdout = subprocess.PIPE)
output = popen.communicate () [0]
if popen.returncode != 0:
- print >> sys.stderr, "Error: git failed"
+ print ("Error: git failed", file=sys.stderr)
exit (1)
return output
@@ -96,7 +97,7 @@ def format_changelog_entries (commit, changed_files, prefix, file_entries, all_p
for (filename, entity) in files:
entry_changelogs = changelogs_for_file_pattern (filename, changed_files)
if len (entry_changelogs) == 0:
- print "Warning: could not match file %s in commit %s" % (filename, commit)
+ print ("Warning: could not match file {0} in commit {1}".format (filename, commit))
for changelog in entry_changelogs:
if changelog not in changelog_entries:
changelog_entries [changelog] = []
@@ -111,7 +112,7 @@ def format_changelog_entries (commit, changed_files, prefix, file_entries, all_p
unmarked_changelogs = changelogs - marked_changelogs
for changelog in unmarked_changelogs:
if len (prefix) == 0:
- print "Warning: empty entry in %s for commit %s" % (changelog_path (changelog), commit)
+ print ("Warning: empty entry in {0} for commit {1}".format (changelog_path (changelog), commit))
insert_paragraphs = all_paragraphs
else:
insert_paragraphs = prefix
@@ -121,14 +122,14 @@ def format_changelog_entries (commit, changed_files, prefix, file_entries, all_p
return paragraphs
def debug_print_commit (commit, raw_message, prefix, file_entries, changed_files, changelog_entries):
- print "===================== Commit"
- print commit
- print "--------------------- RAW"
- print raw_message
- print "--------------------- Prefix"
+ print ("===================== Commit")
+ print (commit)
+ print ("--------------------- RAW")
+ print (raw_message)
+ print ("--------------------- Prefix")
for line in prefix:
- print line
- print "--------------------- File entries"
+ print (line)
+ print ("--------------------- File entries")
for (files, comments) in file_entries:
files_str = ""
for (filename, entity) in files:
@@ -139,15 +140,15 @@ def debug_print_commit (commit, raw_message, prefix, file_entries, changed_files
files_str = files_str + " (" + entity + ")"
print files_str
for line in comments:
- print " " + line
- print "--------------------- Files touched"
+ print (" " + line)
+ print ("--------------------- Files touched")
for f in changed_files:
- print f
- print "--------------------- ChangeLog entries"
+ print (f)
+ print ("--------------------- ChangeLog entries")
for ((dirname, filename), lines) in changelog_entries.items ():
- print "%s/%s:" % (dirname, filename)
+ print ("{0}/{1}:".format (dirname, filename))
for line in lines:
- print line
+ print (line)
def process_commit (commit):
changed_files = map (lambda l: l.split () [2], git ("diff-tree", "--numstat", commit).splitlines () [1:])
@@ -258,7 +259,7 @@ def main ():
#see if git supports %B in --format
output = git ("log", "-n1", "--format=%B", HEAD)
if output.startswith ("%B"):
- print >> sys.stderr, "Error: git doesn't support %B in --format - install version 1.7.2 or newer"
+ print ("Error: git doesn't support %B in --format - install version 1.7.2 or newer", file=sys.stderr)
exit (1)
for filename in git ("ls-tree", "-r", "--name-only", HEAD).splitlines ():
@@ -266,7 +267,7 @@ def main ():
(path, name) = os.path.split (filename)
all_changelogs [path] = name
- commits = git ("rev-list", "--no-merges", HEAD, "^%s" % start_commit).splitlines ()
+ commits = git ("rev-list", "--no-merges", HEAD, "^{0}".format (start_commit)).splitlines ()
touched_changelogs = {}
for commit in commits: