| OLD | NEW |
| 1 # Copyright 2013 The LUCI Authors. All rights reserved. | 1 # Copyright 2013 The LUCI Authors. All rights reserved. |
| 2 # Use of this source code is governed under the Apache License, Version 2.0 | 2 # Use of this source code is governed under the Apache License, Version 2.0 |
| 3 # that can be found in the LICENSE file. | 3 # that can be found in the LICENSE file. |
| 4 | 4 |
| 5 import contextlib | 5 import contextlib |
| 6 import copy | 6 import copy |
| 7 | 7 |
| 8 from recipe_engine import recipe_api | 8 from recipe_engine import recipe_api |
| 9 | 9 |
| 10 | 10 |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 break | 180 break |
| 181 | 181 |
| 182 step_count = self._step_names.setdefault(full_name, 1) + 1 | 182 step_count = self._step_names.setdefault(full_name, 1) + 1 |
| 183 self._step_names[full_name] = step_count | 183 self._step_names[full_name] = step_count |
| 184 name_suffix = ' (%d)' % step_count | 184 name_suffix = ' (%d)' % step_count |
| 185 self._seen_steps.add(full_name) | 185 self._seen_steps.add(full_name) |
| 186 | 186 |
| 187 cwd = self.m.context.cwd | 187 cwd = self.m.context.cwd |
| 188 if cwd is not None and cwd != self.m.path['start_dir']: | 188 if cwd is not None and cwd != self.m.path['start_dir']: |
| 189 kwargs['cwd'] = cwd | 189 kwargs['cwd'] = cwd |
| 190 |
| 191 with self.m.context(env_prefixes={'PATH': self._prefix_path}): |
| 192 kwargs['env_prefixes'] = self.m.context.env_prefixes |
| 190 kwargs['env'] = self.m.context.env | 193 kwargs['env'] = self.m.context.env |
| 191 if self._prefix_path: | |
| 192 ps = self.m.path.pathsep | |
| 193 prefix = ps.join(self._prefix_path) | |
| 194 suffix = kwargs['env'].get('PATH', '%(PATH)s') | |
| 195 kwargs['env']['PATH'] = '%s%s%s' % (prefix, ps, suffix) | |
| 196 kwargs['infra_step'] = self.m.context.infra_step or bool(infra_step) | 194 kwargs['infra_step'] = self.m.context.infra_step or bool(infra_step) |
| 197 kwargs['step_nest_level'] = self.m.context.nest_level | 195 kwargs['step_nest_level'] = self.m.context.nest_level |
| 198 kwargs['name'] = full_name | 196 kwargs['name'] = full_name |
| 199 kwargs['base_name'] = name | 197 kwargs['base_name'] = name |
| 200 | 198 |
| 201 schema = self.make_config() | 199 schema = self.make_config() |
| 202 schema.set_val(kwargs) | 200 schema.set_val(kwargs) |
| 203 return self.run_from_dict(schema.as_jsonish()) | 201 return self.run_from_dict(schema.as_jsonish()) |
| 204 | 202 |
| 205 # TODO(martiniss) delete, and make generator_script use **kwargs on step() | 203 # TODO(martiniss) delete, and make generator_script use **kwargs on step() |
| 206 @recipe_api.composite_step | 204 @recipe_api.composite_step |
| 207 def run_from_dict(self, dct): | 205 def run_from_dict(self, dct): |
| 208 return self.step_client.run_step(dct) | 206 return self.step_client.run_step(dct) |
| OLD | NEW |