Use print() function in both Python 2 and Python 3

pull/21130/head
Christian Clauss 3 years ago
parent 444218e755
commit cdbb042ce4
  1. 17
      modules/ts/misc/chart.py
  2. 3
      modules/ts/misc/report.py
  3. 3
      modules/ts/misc/summary.py

@ -1,5 +1,6 @@
#!/usr/bin/env python
from __future__ import print_function
import testlog_parser, sys, os, xml, re
from table_formatter import *
from optparse import OptionParser
@ -116,7 +117,7 @@ if __name__ == "__main__":
(options, args) = parser.parse_args()
if len(args) != 1:
print >> sys.stderr, "Usage:\n", os.path.basename(sys.argv[0]), "<log_name1>.xml"
print("Usage:\n", os.path.basename(sys.argv[0]), "<log_name1>.xml", file=sys.stderr)
exit(1)
options.generateHtml = detectHtmlOutputType(options.format)
@ -136,7 +137,7 @@ if __name__ == "__main__":
args[0] = os.path.basename(args[0])
if not tests:
print >> sys.stderr, "Error - no tests matched"
print("Error - no tests matched", file=sys.stderr)
exit(1)
argsnum = len(tests[0][1])
@ -156,26 +157,26 @@ if __name__ == "__main__":
names1.add(sn)
if sn == sname:
if len(pair[1]) != argsnum:
print >> sys.stderr, "Error - unable to create chart tables for functions having different argument numbers"
print("Error - unable to create chart tables for functions having different argument numbers", file=sys.stderr)
sys.exit(1)
for i in range(argsnum):
arglists[i][pair[1][i]] = 1
if names1 or len(names) != 1:
print >> sys.stderr, "Error - unable to create tables for functions from different test suits:"
print("Error - unable to create tables for functions from different test suits:", file=sys.stderr)
i = 1
for name in sorted(names):
print >> sys.stderr, "%4s: %s" % (i, name)
print("%4s: %s" % (i, name), file=sys.stderr)
i += 1
if names1:
print >> sys.stderr, "Other suits in this log (can not be chosen):"
print("Other suits in this log (can not be chosen):", file=sys.stderr)
for name in sorted(names1):
print >> sys.stderr, "%4s: %s" % (i, name)
print("%4s: %s" % (i, name), file=sys.stderr)
i += 1
sys.exit(1)
if argsnum < 2:
print >> sys.stderr, "Error - tests from %s have less than 2 parameters" % sname
print("Error - tests from %s have less than 2 parameters" % sname, file=sys.stderr)
exit(1)
for i in range(argsnum):

@ -1,5 +1,6 @@
#!/usr/bin/env python
from __future__ import print_function
import testlog_parser, sys, os, xml, re, glob
from table_formatter import *
from optparse import OptionParser
@ -14,7 +15,7 @@ if __name__ == "__main__":
(options, args) = parser.parse_args()
if len(args) < 1:
print >> sys.stderr, "Usage:\n", os.path.basename(sys.argv[0]), "<log_name1>.xml"
print("Usage:\n", os.path.basename(sys.argv[0]), "<log_name1>.xml", file=sys.stderr)
exit(0)
options.generateHtml = detectHtmlOutputType(options.format)

@ -1,5 +1,6 @@
#!/usr/bin/env python
from __future__ import print_function
import testlog_parser, sys, os, xml, glob, re
from table_formatter import *
from optparse import OptionParser
@ -26,7 +27,7 @@ def getSetName(tset, idx, columns, short = True):
if __name__ == "__main__":
if len(sys.argv) < 2:
print >> sys.stderr, "Usage:\n", os.path.basename(sys.argv[0]), "<log_name1>.xml [<log_name2>.xml ...]"
print("Usage:\n", os.path.basename(sys.argv[0]), "<log_name1>.xml [<log_name2>.xml ...]", file=sys.stderr)
exit(0)
parser = OptionParser()

Loading…
Cancel
Save