| 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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 class AnnotationFilter(chromium_utils.RunCommandFilter): | 373 class AnnotationFilter(chromium_utils.RunCommandFilter): |
| 374 def FilterLine(self, line): | 374 def FilterLine(self, line): |
| 375 return line.replace('@@@', '###') | 375 return line.replace('@@@', '###') |
| 376 filter_obj = AnnotationFilter() | 376 filter_obj = AnnotationFilter() |
| 377 | 377 |
| 378 try: | 378 try: |
| 379 with stream.step(name) as s: | 379 with stream.step(name) as s: |
| 380 ret = chromium_utils.RunCommand(command=map(str, cmd), | 380 ret = chromium_utils.RunCommand(command=map(str, cmd), |
| 381 cwd=cwd, | 381 cwd=cwd, |
| 382 env=_merge_envs(os.environ, env), | 382 env=_merge_envs(os.environ, env), |
| 383 filter_obj=filter_obj) | 383 filter_obj=filter_obj, |
| 384 pipes=step_dict.get('pipes')) |
| 384 if ret != 0: | 385 if ret != 0: |
| 385 print 'step returned non-zero exit code: %d' % ret | 386 print 'step returned non-zero exit code: %d' % ret |
| 386 print 'step was: %s' % json.dumps(step_dict) | 387 print 'step was: %s' % json.dumps(step_dict) |
| 387 s.step_failure() | 388 s.step_failure() |
| 388 build_failure = True | 389 build_failure = True |
| 389 except OSError: | 390 except OSError: |
| 390 # File wasn't found, error has been already reported to stream. | 391 # File wasn't found, error has been already reported to stream. |
| 391 build_failure = True | 392 build_failure = True |
| 392 | 393 |
| 393 return build_failure | 394 return build_failure |
| (...skipping 24 matching lines...) Expand all Loading... |
| 418 | 419 |
| 419 stream = StructuredAnnotationStream(seed_steps=[s['name'] for s in steps]) | 420 stream = StructuredAnnotationStream(seed_steps=[s['name'] for s in steps]) |
| 420 build_failure = False | 421 build_failure = False |
| 421 for step in steps: | 422 for step in steps: |
| 422 build_failure = _run_step(stream, build_failure, **step) | 423 build_failure = _run_step(stream, build_failure, **step) |
| 423 return 1 if build_failure else 0 | 424 return 1 if build_failure else 0 |
| 424 | 425 |
| 425 | 426 |
| 426 if __name__ == '__main__': | 427 if __name__ == '__main__': |
| 427 sys.exit(main()) | 428 sys.exit(main()) |
| OLD | NEW |