OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import re | 5 import re |
6 | 6 |
7 from slave import recipe_api | 7 from slave import recipe_api |
8 | 8 |
9 class FilterApi(recipe_api.RecipeApi): | 9 class FilterApi(recipe_api.RecipeApi): |
10 def __init__(self, **kwargs): | 10 def __init__(self, **kwargs): |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 self._result = 1 | 68 self._result = 1 |
69 return | 69 return |
70 | 70 |
71 analyze_input = {'files': paths, 'targets': self._matching_exes} | 71 analyze_input = {'files': paths, 'targets': self._matching_exes} |
72 | 72 |
73 test_output = {'status': 'No dependency', 'targets': []} | 73 test_output = {'status': 'No dependency', 'targets': []} |
74 | 74 |
75 kwargs.setdefault('env', {}) | 75 kwargs.setdefault('env', {}) |
76 kwargs['env'].update(self.m.chromium.c.gyp_env.as_jsonish()) | 76 kwargs['env'].update(self.m.chromium.c.gyp_env.as_jsonish()) |
77 | 77 |
78 step_result = self.m.python('analyze', | 78 try: |
79 self.m.path['checkout'].join('build', 'gyp_chromium'), | 79 step_result = self.m.python('analyze', |
80 args=['--analyzer2', | 80 self.m.path['checkout'].join('build', 'gyp_chromium'), |
81 self.m.json.input(analyze_input), | 81 args=['--analyzer2', |
82 self.m.json.output()], | 82 self.m.json.input(analyze_input), |
83 step_test_data=lambda: self.m.json.test_api.output( | 83 self.m.json.output()], |
84 test_output), | 84 step_test_data=lambda: self.m.json.test_api.output( |
85 **kwargs) | 85 test_output), |
| 86 **kwargs) |
| 87 except self.m.step.StepFailure as f: |
| 88 # Continue on if there is an error executing python. Most likely runhooks |
| 89 # will fail too, but errors there are more well understood than here. |
| 90 self._result = True |
| 91 step_result = f.result |
| 92 step_result.presentation.status = 'WARNING' |
| 93 return |
| 94 |
86 if 'error' in step_result.json.output: | 95 if 'error' in step_result.json.output: |
87 self._result = True | 96 self._result = True |
88 step_result.presentation.step_text = 'Error: ' + \ | 97 step_result.presentation.step_text = 'Error: ' + \ |
89 step_result.json.output['error'] | 98 step_result.json.output['error'] |
90 elif step_result.json.output['status'] == 'Found dependency': | 99 elif step_result.json.output['status'] == 'Found dependency': |
91 self._matching_exes = step_result.json.output['targets'] | 100 self._matching_exes = step_result.json.output['targets'] |
92 self._result = True | 101 self._result = True |
93 else: | 102 else: |
94 step_result.presentation.step_text = 'No compile necessary' | 103 step_result.presentation.step_text = 'No compile necessary' |
OLD | NEW |