diff options
author | Mike Pagano <mpagano@gentoo.org> | 2013-10-09 10:36:42 -0400 |
---|---|---|
committer | Michal Marek <mmarek@suse.cz> | 2013-10-23 11:13:42 -0400 |
commit | f29b5f3e6fc0a8b7a1c3f626d09bfa17ccb61f99 (patch) | |
tree | 6629a3fd48aa6a046876f79ee96d0f749b0608d3 /scripts | |
parent | a690876385f29c740798cb99aa2511217ecd9954 (diff) |
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: Mike Pagano <mpagano@gentoo.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/show_delta | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/scripts/show_delta b/scripts/show_delta index 17df3051747a..e25732b5d701 100755 --- a/scripts/show_delta +++ b/scripts/show_delta | |||
@@ -13,7 +13,7 @@ import sys | |||
13 | import string | 13 | import string |
14 | 14 | ||
15 | def usage(): | 15 | def usage(): |
16 | print """usage: show_delta [<options>] <filename> | 16 | print ("""usage: show_delta [<options>] <filename> |
17 | 17 | ||
18 | This program parses the output from a set of printk message lines which | 18 | This program parses the output from a set of printk message lines which |
19 | have time data prefixed because the CONFIG_PRINTK_TIME option is set, or | 19 | have time data prefixed because the CONFIG_PRINTK_TIME option is set, or |
@@ -35,7 +35,7 @@ ex: $ dmesg >timefile | |||
35 | 35 | ||
36 | will show times relative to the line in the kernel output | 36 | will show times relative to the line in the kernel output |
37 | starting with "NET4". | 37 | starting with "NET4". |
38 | """ | 38 | """) |
39 | sys.exit(1) | 39 | sys.exit(1) |
40 | 40 | ||
41 | # returns a tuple containing the seconds and text for each message line | 41 | # returns a tuple containing the seconds and text for each message line |
@@ -94,11 +94,11 @@ def main(): | |||
94 | try: | 94 | try: |
95 | lines = open(filein,"r").readlines() | 95 | lines = open(filein,"r").readlines() |
96 | except: | 96 | except: |
97 | print "Problem opening file: %s" % filein | 97 | print ("Problem opening file: %s" % filein) |
98 | sys.exit(1) | 98 | sys.exit(1) |
99 | 99 | ||
100 | if base_str: | 100 | if base_str: |
101 | print 'base= "%s"' % base_str | 101 | print ('base= "%s"' % base_str) |
102 | # assume a numeric base. If that fails, try searching | 102 | # assume a numeric base. If that fails, try searching |
103 | # for a matching line. | 103 | # for a matching line. |
104 | try: | 104 | try: |
@@ -117,13 +117,13 @@ def main(): | |||
117 | # stop at first match | 117 | # stop at first match |
118 | break | 118 | break |
119 | if not found: | 119 | if not found: |
120 | print 'Couldn\'t find line matching base pattern "%s"' % base_str | 120 | print ('Couldn\'t find line matching base pattern "%s"' % base_str) |
121 | sys.exit(1) | 121 | sys.exit(1) |
122 | else: | 122 | else: |
123 | base_time = 0.0 | 123 | base_time = 0.0 |
124 | 124 | ||
125 | for line in lines: | 125 | for line in lines: |
126 | print convert_line(line, base_time), | 126 | print (convert_line(line, base_time),) |
127 | 127 | ||
128 | main() | 128 | main() |
129 | 129 | ||