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

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

Issue 1906323003: recipe engine: extract infra-specific paths out of the engine (Closed) Base URL: https://github.com/luci/recipes-py.git@master
Patch Set: tmp Created 4 years, 8 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 Chromium Authors. All rights reserved. 1 # Copyright 2013 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 contextlib 5 import contextlib
6 6
7 from recipe_engine import recipe_api 7 from recipe_engine import recipe_api
8 8
9 9
10 # Inherit from RecipeApiPlain because the only thing which is a step is 10 # Inherit from RecipeApiPlain because the only thing which is a step is
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 kwargs['cmd'] = command 124 kwargs['cmd'] = command
125 125
126 kwargs['ok_ret'] = ok_ret 126 kwargs['ok_ret'] = ok_ret
127 kwargs['infra_step'] = bool(infra_step) 127 kwargs['infra_step'] = bool(infra_step)
128 128
129 # Obtain information from composite step parent. 129 # Obtain information from composite step parent.
130 compositor = recipe_api._STEP_CONTEXT 130 compositor = recipe_api._STEP_CONTEXT
131 name = compositor.get_with_context('name', name) 131 name = compositor.get_with_context('name', name)
132 kwargs['env'] = compositor.get_with_context('env', kwargs.get('env', {})) 132 kwargs['env'] = compositor.get_with_context('env', kwargs.get('env', {}))
133 kwargs['step_nest_level'] = compositor.get_with_context('nest_level', 0) 133 kwargs['step_nest_level'] = compositor.get_with_context('nest_level', 0)
134 kwargs.setdefault('cwd', self.m.path['slave_build'])
135 134
136 # Disambiguate repeated names 135 # Disambiguate repeated names
137 step_count = self._step_names.setdefault(name, 0) + 1 136 step_count = self._step_names.setdefault(name, 0) + 1
138 self._step_names[name] = step_count 137 self._step_names[name] = step_count
139 if step_count > 1: 138 if step_count > 1:
140 name = "%s (%d)" % (name, step_count) 139 name = "%s (%d)" % (name, step_count)
141 kwargs['name'] = name 140 kwargs['name'] = name
142 141
143 schema = self.make_config() 142 schema = self.make_config()
144 schema.set_val(kwargs) 143 schema.set_val(kwargs)
145 return self.run_from_dict(self._engine.create_step(schema)) 144 return self.run_from_dict(self._engine.create_step(schema))
146 145
147 # TODO(martiniss) delete, and make generator_script use **kwargs on step() 146 # TODO(martiniss) delete, and make generator_script use **kwargs on step()
148 @recipe_api.composite_step 147 @recipe_api.composite_step
149 def run_from_dict(self, dct): 148 def run_from_dict(self, dct):
150 return self._engine.run_step(dct) 149 return self._engine.run_step(dct)
OLDNEW
« no previous file with comments | « recipe_modules/shutil/example.expected/basic.json ('k') | recipe_modules/step/example.expected/basic.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698