提交 bd5edbe6 编写于 作者: C Corentin Labbe 提交者: Tony Luck

ia64: convert unwcheck.py to python3

Since my system use python3 as default, arch/ia64/scripts/unwcheck.py no
longer run.

This patch convert it to the python3 syntax.
I have ran it with python2/python3 while printing values of
start/end/rlen_sum which could be impacted by this change and I see no difference.

Fixes: 94a47083 ("scripts: change scripts to use system python instead of env")
Signed-off-by: NCorentin Labbe <clabbe@baylibre.com>
Signed-off-by: NTony Luck <tony.luck@intel.com>
上级 661e50bc
...@@ -16,7 +16,7 @@ import re ...@@ -16,7 +16,7 @@ import re
import sys import sys
if len(sys.argv) != 2: if len(sys.argv) != 2:
print "Usage: %s FILE" % sys.argv[0] print("Usage: %s FILE" % sys.argv[0])
sys.exit(2) sys.exit(2)
readelf = os.getenv("READELF", "readelf") readelf = os.getenv("READELF", "readelf")
...@@ -29,7 +29,7 @@ def check_func (func, slots, rlen_sum): ...@@ -29,7 +29,7 @@ def check_func (func, slots, rlen_sum):
global num_errors global num_errors
num_errors += 1 num_errors += 1
if not func: func = "[%#x-%#x]" % (start, end) if not func: func = "[%#x-%#x]" % (start, end)
print "ERROR: %s: %lu slots, total region length = %lu" % (func, slots, rlen_sum) print("ERROR: %s: %lu slots, total region length = %lu" % (func, slots, rlen_sum))
return return
num_funcs = 0 num_funcs = 0
...@@ -43,23 +43,23 @@ for line in os.popen("%s -u %s" % (readelf, sys.argv[1])): ...@@ -43,23 +43,23 @@ for line in os.popen("%s -u %s" % (readelf, sys.argv[1])):
check_func(func, slots, rlen_sum) check_func(func, slots, rlen_sum)
func = m.group(1) func = m.group(1)
start = long(m.group(2), 16) start = int(m.group(2), 16)
end = long(m.group(3), 16) end = int(m.group(3), 16)
slots = 3 * (end - start) / 16 slots = 3 * (end - start) / 16
rlen_sum = 0L rlen_sum = 0
num_funcs += 1 num_funcs += 1
else: else:
m = rlen_pattern.match(line) m = rlen_pattern.match(line)
if m: if m:
rlen_sum += long(m.group(1)) rlen_sum += int(m.group(1))
check_func(func, slots, rlen_sum) check_func(func, slots, rlen_sum)
if num_errors == 0: if num_errors == 0:
print "No errors detected in %u functions." % num_funcs print("No errors detected in %u functions." % num_funcs)
else: else:
if num_errors > 1: if num_errors > 1:
err="errors" err="errors"
else: else:
err="error" err="error"
print "%u %s detected in %u functions." % (num_errors, err, num_funcs) print("%u %s detected in %u functions." % (num_errors, err, num_funcs))
sys.exit(1) sys.exit(1)
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册