summaryrefslogtreecommitdiffstats
path: root/scripts/pybootchartgui/pybootchartgui/parsing.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2019-05-08 11:48:35 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-05-08 22:56:45 +0100
commit020911ab590624406f406237f8750b0ea8be320b (patch)
treeb27790bf6a76204f0288062bad03cf0b94d8b24e /scripts/pybootchartgui/pybootchartgui/parsing.py
parentd13b904305289df1d3ab81f86350d7ff99d2966d (diff)
downloadpoky-020911ab590624406f406237f8750b0ea8be320b.tar.gz
scripts/pybootchart: Port to python3
This updates the pybootchart code (used for viewing build timing profiles) to use python3. The bulk of the changes are to use gi instead of pygtk, i.e. port from gtk+2 to gtk+3. The main change is to make the bootchart widget inherit gtk.Scrollable and change the way the scrollbars are implemented to match the new method upstream. The drawing code used cairo already so can remain unchanged, (From OE-Core rev: 949144681ad7f536732169351cab6d0612e9c566) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/pybootchartgui/pybootchartgui/parsing.py')
-rw-r--r--scripts/pybootchartgui/pybootchartgui/parsing.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/scripts/pybootchartgui/pybootchartgui/parsing.py b/scripts/pybootchartgui/pybootchartgui/parsing.py
index bcfb2da569..ef2d3d309c 100644
--- a/scripts/pybootchartgui/pybootchartgui/parsing.py
+++ b/scripts/pybootchartgui/pybootchartgui/parsing.py
@@ -267,7 +267,7 @@ def _parse_headers(file):
267 value = line.strip() 267 value = line.strip()
268 headers[last] += value 268 headers[last] += value
269 return headers, last 269 return headers, last
270 return reduce(parse, file.read().decode('utf-8').split('\n'), (defaultdict(str),''))[0] 270 return reduce(parse, file.read().split('\n'), (defaultdict(str),''))[0]
271 271
272def _parse_timed_blocks(file): 272def _parse_timed_blocks(file):
273 """Parses (ie., splits) a file into so-called timed-blocks. A 273 """Parses (ie., splits) a file into so-called timed-blocks. A
@@ -281,7 +281,7 @@ def _parse_timed_blocks(file):
281 return (int(lines[0]), lines[1:]) 281 return (int(lines[0]), lines[1:])
282 except ValueError: 282 except ValueError:
283 raise ParseError("expected a timed-block, but timestamp '%s' is not an integer" % lines[0]) 283 raise ParseError("expected a timed-block, but timestamp '%s' is not an integer" % lines[0])
284 blocks = file.read().decode('utf-8').split('\n\n') 284 blocks = file.read().split('\n\n')
285 return [parse(block) for block in blocks if block.strip() and not block.endswith(' not running\n')] 285 return [parse(block) for block in blocks if block.strip() and not block.endswith(' not running\n')]
286 286
287def _parse_proc_ps_log(writer, file): 287def _parse_proc_ps_log(writer, file):
@@ -577,7 +577,7 @@ def _parse_dmesg(writer, file):
577 processMap['k-boot'] = kernel 577 processMap['k-boot'] = kernel
578 base_ts = False 578 base_ts = False
579 max_ts = 0 579 max_ts = 0
580 for line in file.read().decode('utf-8').split('\n'): 580 for line in file.read().split('\n'):
581 t = timestamp_re.match (line) 581 t = timestamp_re.match (line)
582 if t is None: 582 if t is None:
583# print "duff timestamp " + line 583# print "duff timestamp " + line
@@ -665,7 +665,7 @@ def _parse_pacct(writer, file):
665def _parse_paternity_log(writer, file): 665def _parse_paternity_log(writer, file):
666 parent_map = {} 666 parent_map = {}
667 parent_map[0] = 0 667 parent_map[0] = 0
668 for line in file.read().decode('utf-8').split('\n'): 668 for line in file.read().split('\n'):
669 if not line: 669 if not line:
670 continue 670 continue
671 elems = line.split(' ') # <Child> <Parent> 671 elems = line.split(' ') # <Child> <Parent>
@@ -678,7 +678,7 @@ def _parse_paternity_log(writer, file):
678 678
679def _parse_cmdline_log(writer, file): 679def _parse_cmdline_log(writer, file):
680 cmdLines = {} 680 cmdLines = {}
681 for block in file.read().decode('utf-8').split('\n\n'): 681 for block in file.read().split('\n\n'):
682 lines = block.split('\n') 682 lines = block.split('\n')
683 if len (lines) >= 3: 683 if len (lines) >= 3:
684# print "Lines '%s'" % (lines[0]) 684# print "Lines '%s'" % (lines[0])
@@ -751,7 +751,7 @@ def parse_file(writer, state, filename):
751 if state.filename is None: 751 if state.filename is None:
752 state.filename = filename 752 state.filename = filename
753 basename = os.path.basename(filename) 753 basename = os.path.basename(filename)
754 with open(filename, "rb") as file: 754 with open(filename, "r") as file:
755 return _do_parse(writer, state, filename, file) 755 return _do_parse(writer, state, filename, file)
756 756
757def parse_paths(writer, state, paths): 757def parse_paths(writer, state, paths):