From 5f0cc9df1da9187a83b66c98a679ac9ab2c72b3c Mon Sep 17 00:00:00 2001 From: Lauro Moura Date: Wed, 24 Apr 2019 11:43:49 -0300 Subject: [PATCH] 2to3 modifications to expedite-cmp Summary: Make expedite-cmp runnable with py3 Reviewers: cedric, bu5hm4n, zmike Differential Revision: https://phab.enlightenment.org/D8700 --- src/bin/expedite-cmp | 60 +++++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/src/bin/expedite-cmp b/src/bin/expedite-cmp index 2df01ad..ea6d5ec 100755 --- a/src/bin/expedite-cmp +++ b/src/bin/expedite-cmp @@ -1,5 +1,7 @@ #!/usr/bin/env python +from __future__ import print_function + import sys import os import os.path @@ -68,12 +70,12 @@ def report_text(): fmtsize = len(options.format % {"value": 12345.67, "percentual": 1234.56}) hdrfmt = "%%%d.%ds" % (fmtsize, fmtsize) - print test_name_fmt % "\\", - print "%7.7s" % (files[0][-7:],), + print(test_name_fmt % "\\", end=' ') + print("%7.7s" % (files[0][-7:],), end=' ') for f in files[1:]: n, e = os.path.splitext(f) - print hdrfmt % n[-fmtsize:], - print + print(hdrfmt % n[-fmtsize:], end=' ') + print() if options.color and os.environ.get("TERM", "") in ( "xterm", "xterm-color", "rxvt", "rxvt-unicode", "screen", @@ -90,14 +92,14 @@ def report_text(): def print_row(test): - print test_name_fmt % test, + print(test_name_fmt % test, end=' ') ref_val = data[ref_f][test] - print "%7.2f" % ref_val, + print("%7.2f" % ref_val, end=' ') for f in others_f: try: val = data[f][test] except KeyError: - print "-?????-", + print("-?????-", end=' ') continue percent = (val - ref_val) / ref_val @@ -111,9 +113,9 @@ def report_text(): fmt = options.format % {"value": val, "percentual": percent * 100} if len(fmt) < fmtsize: fmt = hdrfmt % fmt - print "%s%s%s" % (c, fmt, color_reset), + print("%s%s%s" % (c, fmt, color_reset), end=' ') - print + print() for t in tests: print_row(t) @@ -123,7 +125,7 @@ def report_html(): import time fnames = [os.path.basename(f) for f in files] - print """\ + print("""\ @@ -156,9 +158,9 @@ def report_html(): border-bottom: 1px dashed #ccc; } td.test-name, thead tr td { text-align: right; }\ -""" +""") if options.color: - print """\ + print("""\ td.value-good { background-color: #aaffaa; } td.value-bad { background-color: #ffaaaa; } td.value-missing { background-color: #ffffaa; } @@ -168,9 +170,9 @@ def report_html(): background-color: #d9d9d9; border-bottom: 1px dashed #ccc; } -""" +""") - print """ + print("""

Comparison sheet for %(files)s, created at %(date)s.

@@ -180,17 +182,17 @@ def report_html(): \\\ """ % {"files": ", ".join(fnames), "date": time.asctime(), - } + }) for f in fnames: - print """\ + print("""\ %s\ -""" % f - print """\ +""" % f) + print("""\ \ -""" +""") def print_row(test): ref_val = data[ref_f][test] @@ -199,19 +201,19 @@ def report_html(): else: extra_cls = "" - print """\ + print("""\ %s %7.2f\ -""" % (extra_cls, test, ref_val) +""" % (extra_cls, test, ref_val)) for f in others_f: try: val = data[f][test] except KeyError: - print """\ + print("""\ -?????-\ -""" +""") continue percent = (val - ref_val) / ref_val @@ -224,23 +226,23 @@ def report_html(): v = options.format % {"value": val, "percentual": percent * 100} - print """\ + print("""\ %s\ -""" % (c, v) +""" % (c, v)) - print """\ + print("""\ \ -""" +""") for t in tests: print_row(t) - print """\ + print("""\ -""" +""") if options.report == "text": report_text()