comparison mx/outputparser.py @ 4282:063ea022532c

mx commands : improve bench command, fix in the outparser so that no empty 'line' is retruned if there was no match, fix bootstrap's regex
author Gilles Duboscq <gilles.m.duboscq@gmail.com>
date Fri, 13 Jan 2012 16:11:18 +0100
parents 339cf8d4904d
children 3aab15f42934
comparison
equal deleted inserted replaced
4276:f8f262212aa4 4282:063ea022532c
35 35
36 def addMatcher(self, matcher): 36 def addMatcher(self, matcher):
37 self.matchers.append(matcher) 37 self.matchers.append(matcher)
38 38
39 def parse(self, vm, cmd, cwd=None, vmbuild=None): 39 def parse(self, vm, cmd, cwd=None, vmbuild=None):
40 ret = [{}] 40 ret = []
41 41
42 def parseLine(line): 42 def parseLine(line):
43 anyMatch = False 43 anyMatch = False
44 for matcher in self.matchers: 44 for matcher in self.matchers:
45 parsed = matcher.parse(line.strip()) 45 parsed = matcher.parse(line.strip())
46 if parsed: 46 if parsed:
47 anyMatch = True 47 anyMatch = True
48 if matcher.startNewLine and len(ret[0]) > 0: 48 if len(ret) is 0 or (matcher.startNewLine and len(ret[len(ret)-1]) > 0):
49 ret.append({}) 49 ret.append({})
50 ret[len(ret)-1].update(parsed) 50 ret[len(ret)-1].update(parsed)
51 if anyMatch : 51 if anyMatch :
52 mx.log('>' + line.rstrip()) 52 mx.log('>' + line.rstrip())
53 else : 53 else :