| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """Contains generating and parsing systems of the Chromium Buildbot Annotator. | 6 """Contains generating and parsing systems of the Chromium Buildbot Annotator. |
| 7 | 7 |
| 8 When executed as a script, this reads step name / command pairs from a file and | 8 When executed as a script, this reads step name / command pairs from a file and |
| 9 executes those lines while annotating the output. The input is json: | 9 executes those lines while annotating the output. The input is json: |
| 10 | 10 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 | 71 |
| 72 def step_log_line(self, logname, line): | 72 def step_log_line(self, logname, line): |
| 73 self.emit('@@@STEP_LOG_LINE@%s@%s@@@' % (logname, line.rstrip('\n'))) | 73 self.emit('@@@STEP_LOG_LINE@%s@%s@@@' % (logname, line.rstrip('\n'))) |
| 74 | 74 |
| 75 def step_log_end(self, logname): | 75 def step_log_end(self, logname): |
| 76 self.emit('@@@STEP_LOG_END@%s@@@' % logname) | 76 self.emit('@@@STEP_LOG_END@%s@@@' % logname) |
| 77 | 77 |
| 78 def step_log_end_perf(self, logname, perf): | 78 def step_log_end_perf(self, logname, perf): |
| 79 self.emit('@@@STEP_LOG_END_PERF@%s@%s@@@' % (logname, perf)) | 79 self.emit('@@@STEP_LOG_END_PERF@%s@%s@@@' % (logname, perf)) |
| 80 | 80 |
| 81 def step_link(self, label, url): |
| 82 self.emit('@@@STEP_LINK@%s@%s@@@' % (label, url)) |
| 83 |
| 81 def write_log_lines(self, logname, lines, perf=None): | 84 def write_log_lines(self, logname, lines, perf=None): |
| 82 if logname in self.emitted_logs: | 85 if logname in self.emitted_logs: |
| 83 raise ValueError('Log %s has been emitted multiple times.' % logname) | 86 raise ValueError('Log %s has been emitted multiple times.' % logname) |
| 84 self.emitted_logs.add(logname) | 87 self.emitted_logs.add(logname) |
| 85 | 88 |
| 86 for line in lines: | 89 for line in lines: |
| 87 self.step_log_line(logname, line) | 90 self.step_log_line(logname, line) |
| 88 if perf: | 91 if perf: |
| 89 self.step_log_end_perf(logname, perf) | 92 self.step_log_end_perf(logname, perf) |
| 90 else: | 93 else: |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 steps.extend(json.load(sys.stdin, object_hook=force_dict_strs)) | 589 steps.extend(json.load(sys.stdin, object_hook=force_dict_strs)) |
| 587 else: | 590 else: |
| 588 with open(args[0], 'rb') as f: | 591 with open(args[0], 'rb') as f: |
| 589 steps.extend(json.load(f, object_hook=force_dict_strs)) | 592 steps.extend(json.load(f, object_hook=force_dict_strs)) |
| 590 | 593 |
| 591 return 1 if run_steps(steps, False)[0] else 0 | 594 return 1 if run_steps(steps, False)[0] else 0 |
| 592 | 595 |
| 593 | 596 |
| 594 if __name__ == '__main__': | 597 if __name__ == '__main__': |
| 595 sys.exit(main()) | 598 sys.exit(main()) |
| OLD | NEW |