aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorTim Newsome <tim@sifive.com>2022-06-23 08:06:14 -0700
committerGitHub <noreply@github.com>2022-06-23 08:06:14 -0700
commit8488e4e863f6a465189d7dd3e6d94ccc4c493eb4 (patch)
treefc98e02c9eba4c40f0e03480b38637a956d2f68a /tools
parent6d359afde45dba69d2fc2d6fc3f90e32050f8fbf (diff)
downloadriscv-openocd-8488e4e863f6a465189d7dd3e6d94ccc4c493eb4.zip
riscv-openocd-8488e4e863f6a465189d7dd3e6d94ccc4c493eb4.tar.gz
riscv-openocd-8488e4e863f6a465189d7dd3e6d94ccc4c493eb4.tar.bz2
Convert filter_openocd_log.py to use python3. (#709)
Change-Id: Ie7b42bcc3462b737cbff369ac8d3a71322699aaa Signed-off-by: Tim Newsome <tim@sifive.com>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/filter_openocd_log.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/tools/filter_openocd_log.py b/tools/filter_openocd_log.py
index cd38efd..076be20 100755
--- a/tools/filter_openocd_log.py
+++ b/tools/filter_openocd_log.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
import sys
import re
@@ -38,7 +38,7 @@ def shorten_buffer(outfd, buf, current_repetition):
# Look for repeated sequences...
repetitions = []
- for length in range(1, len(buf)/2):
+ for length in range(1, int(len(buf)/2)):
# Is there a repeating sequence of `length` lines?
matched_lines = 0
for i, entry in enumerate(buf[length:]):
@@ -52,7 +52,7 @@ def shorten_buffer(outfd, buf, current_repetition):
if repetitions:
repetitions.sort(key=lambda entry: (entry[0] * (entry[1] / entry[0]), -entry[1]))
matched_lines, length = repetitions[-1]
- repeated = matched_lines / length
+ repeated = int(matched_lines / length)
if repeated * length >= 3:
sequence = buf[:length]
del buf[:repeated * length]
@@ -74,9 +74,9 @@ def shorten_buffer(outfd, buf, current_repetition):
buf.pop(0)
if length_before <= len(buf):
- print "Buffer:"
+ print("Buffer:")
for entry in buf:
- print "%r" % entry[0]
+ print("%r" % entry[0])
assert False
return None