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

Side by Side Diff: scripts/slave/recipe_modules/generator_script/api.py

Issue 24737002: Add Paths as first-class types in configs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
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 from slave import recipe_api 5 from slave import recipe_api
6 6
7 class GeneratorScriptApi(recipe_api.RecipeApi): 7 class GeneratorScriptApi(recipe_api.RecipeApi):
8 def __call__(self, path_to_script, *args): # pragma: no cover 8 def __call__(self, path_to_script, *args): # pragma: no cover
9 """Run a script and generate the steps emitted by that script.""" 9 """Run a script and generate the steps emitted by that script."""
10 f = '--output-json' 10 f = '--output-json'
11 step_name = 'gen step(%s)' % self.m.path.basename(path_to_script) 11 step_name = 'gen step(%s)' % self.m.path.basename(path_to_script)
12 if path_to_script.endswith('.py'): 12 if str(path_to_script).endswith('.py'):
13 yield self.m.python( 13 yield self.m.python(
14 step_name, 14 step_name,
15 path_to_script, list(args) + [f, self.m.json.output()], 15 path_to_script, list(args) + [f, self.m.json.output()],
16 cwd=self.m.path.checkout()) 16 cwd=self.m.path.checkout())
17 else: 17 else:
18 yield self.m.step( 18 yield self.m.step(
19 step_name, 19 step_name,
20 [path_to_script,] + list(args) + [f, self.m.json.output()], 20 [path_to_script,] + list(args) + [f, self.m.json.output()],
21 cwd=self.m.path.checkout()) 21 cwd=self.m.path.checkout())
22 new_steps = self.m.step_history.last_step().json.output 22 new_steps = self.m.step_history.last_step().json.output
23 assert isinstance(new_steps, list) 23 assert isinstance(new_steps, list)
24 yield new_steps 24 yield new_steps
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698