| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 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 | 5 |
| 6 # pylint: disable=W0201 | 6 # pylint: disable=W0201 |
| 7 | 7 |
| 8 | 8 |
| 9 from recipe_engine import recipe_api | 9 from recipe_engine import recipe_api |
| 10 | 10 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 env = dict(env or {}) | 75 env = dict(env or {}) |
| 76 env.update(self.m.vars.default_env) | 76 env.update(self.m.vars.default_env) |
| 77 try: | 77 try: |
| 78 return steptype(name=name, env=env, **kwargs) | 78 return steptype(name=name, env=env, **kwargs) |
| 79 except self.m.step.StepFailure as e: | 79 except self.m.step.StepFailure as e: |
| 80 if abort_on_failure: | 80 if abort_on_failure: |
| 81 raise # pragma: no cover | 81 raise # pragma: no cover |
| 82 if fail_build_on_failure: | 82 if fail_build_on_failure: |
| 83 self._failed.append(e) | 83 self._failed.append(e) |
| 84 | 84 |
| 85 def json_from_file(self, filename, cwd, builder_name, test_data): | |
| 86 """Execute the given script to obtain JSON data.""" | |
| 87 return self.m.python( | |
| 88 'exec %s' % self.m.path.basename(filename), | |
| 89 filename, | |
| 90 args=[self.m.json.output(), builder_name], | |
| 91 step_test_data=lambda: self.m.json.test_api.output(test_data), | |
| 92 cwd=cwd, | |
| 93 infra_step=True).json.output | |
| 94 | |
| 95 def copy_build_products(self, src, dst): | 85 def copy_build_products(self, src, dst): |
| 96 """Copy whitelisted build products from src to dst.""" | 86 """Copy whitelisted build products from src to dst.""" |
| 97 self.m.python.inline( | 87 self.m.python.inline( |
| 98 name='copy build products', | 88 name='copy build products', |
| 99 program='''import errno | 89 program='''import errno |
| 100 import glob | 90 import glob |
| 101 import os | 91 import os |
| 102 import shutil | 92 import shutil |
| 103 import sys | 93 import sys |
| 104 | 94 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 print json.dumps({'ccache': ccache}) | 133 print json.dumps({'ccache': ccache}) |
| 144 ''', | 134 ''', |
| 145 stdout=self.m.json.output(), | 135 stdout=self.m.json.output(), |
| 146 infra_step=True, | 136 infra_step=True, |
| 147 abort_on_failure=False, | 137 abort_on_failure=False, |
| 148 fail_build_on_failure=False) | 138 fail_build_on_failure=False) |
| 149 if result and result.stdout and result.stdout.get('ccache'): | 139 if result and result.stdout and result.stdout.get('ccache'): |
| 150 self._ccache = result.stdout['ccache'] | 140 self._ccache = result.stdout['ccache'] |
| 151 | 141 |
| 152 return self._ccache | 142 return self._ccache |
| OLD | NEW |