Commit f29b5f3e authored by Mike Pagano's avatar Mike Pagano Committed by Michal Marek

show_delta: Update script to support python versions 2.5 through 3.3

Support past and active versions of python while maintaining backward compatibility. Script has been tested on python versions from 2.5.x up to and including 3.3.x.
Signed-off-by: default avatarMike Pagano <mpagano@gentoo.org>
Signed-off-by: default avatarMichal Marek <mmarek@suse.cz>
parent a6908763
...@@ -13,7 +13,7 @@ import sys ...@@ -13,7 +13,7 @@ import sys
import string import string
def usage(): def usage():
print """usage: show_delta [<options>] <filename> print ("""usage: show_delta [<options>] <filename>
This program parses the output from a set of printk message lines which This program parses the output from a set of printk message lines which
have time data prefixed because the CONFIG_PRINTK_TIME option is set, or have time data prefixed because the CONFIG_PRINTK_TIME option is set, or
...@@ -35,7 +35,7 @@ ex: $ dmesg >timefile ...@@ -35,7 +35,7 @@ ex: $ dmesg >timefile
will show times relative to the line in the kernel output will show times relative to the line in the kernel output
starting with "NET4". starting with "NET4".
""" """)
sys.exit(1) sys.exit(1)
# returns a tuple containing the seconds and text for each message line # returns a tuple containing the seconds and text for each message line
...@@ -94,11 +94,11 @@ def main(): ...@@ -94,11 +94,11 @@ def main():
try: try:
lines = open(filein,"r").readlines() lines = open(filein,"r").readlines()
except: except:
print "Problem opening file: %s" % filein print ("Problem opening file: %s" % filein)
sys.exit(1) sys.exit(1)
if base_str: if base_str:
print 'base= "%s"' % base_str print ('base= "%s"' % base_str)
# assume a numeric base. If that fails, try searching # assume a numeric base. If that fails, try searching
# for a matching line. # for a matching line.
try: try:
...@@ -117,13 +117,13 @@ def main(): ...@@ -117,13 +117,13 @@ def main():
# stop at first match # stop at first match
break break
if not found: if not found:
print 'Couldn\'t find line matching base pattern "%s"' % base_str print ('Couldn\'t find line matching base pattern "%s"' % base_str)
sys.exit(1) sys.exit(1)
else: else:
base_time = 0.0 base_time = 0.0
for line in lines: for line in lines:
print convert_line(line, base_time), print (convert_line(line, base_time),)
main() main()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment