Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(554)

Side by Side Diff: recipe_modules/step/api.py

Issue 2933473002: [context] Split "env" values and prefixes. (Closed)
Patch Set: plumb pathsep through so we don't assume OS Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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: 194 kwargs['pathsep'] = self.m.path.pathsep
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) 195 kwargs['infra_step'] = self.m.context.infra_step or bool(infra_step)
197 kwargs['step_nest_level'] = self.m.context.nest_level 196 kwargs['step_nest_level'] = self.m.context.nest_level
198 kwargs['name'] = full_name 197 kwargs['name'] = full_name
199 kwargs['base_name'] = name 198 kwargs['base_name'] = name
200 199
201 schema = self.make_config() 200 schema = self.make_config()
202 schema.set_val(kwargs) 201 schema.set_val(kwargs)
203 return self.run_from_dict(schema.as_jsonish()) 202 return self.run_from_dict(schema.as_jsonish())
204 203
205 # TODO(martiniss) delete, and make generator_script use **kwargs on step() 204 # TODO(martiniss) delete, and make generator_script use **kwargs on step()
206 @recipe_api.composite_step 205 @recipe_api.composite_step
207 def run_from_dict(self, dct): 206 def run_from_dict(self, dct):
208 return self.step_client.run_step(dct) 207 return self.step_client.run_step(dct)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698