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

Side by Side Diff: recipe_modules/generator_script/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 2017 The LUCI Authors. All rights reserved. 1 # Copyright 2017 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 from recipe_engine import recipe_api 5 from recipe_engine 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, **kwargs): 8 def __call__(self, path_to_script, *args, **kwargs):
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 10
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 page. Note that these are write-only: The only way to read them is 50 page. Note that these are write-only: The only way to read them is
51 via the status page. There is intentionally no mechanism to read 51 via the status page. There is intentionally no mechanism to read
52 them back from inside of the recipes. 52 them back from inside of the recipes.
53 53
54 kwargs: 54 kwargs:
55 env - The environment for the generated steps. 55 env - The environment for the generated steps.
56 """ 56 """
57 f = '--output-json' 57 f = '--output-json'
58 step_name = 'gen step(%s)' % self.m.path.basename(path_to_script) 58 step_name = 'gen step(%s)' % self.m.path.basename(path_to_script)
59 59
60 kwargs.setdefault('pathsep', self.m.path.pathsep)
60 step_test_data = kwargs.pop('step_test_data', None) 61 step_test_data = kwargs.pop('step_test_data', None)
61 with self.m.context(cwd=self.m.path['checkout']): 62 with self.m.context(cwd=self.m.path['checkout']):
62 if str(path_to_script).endswith('.py'): 63 if str(path_to_script).endswith('.py'):
63 step_result = self.m.python( 64 step_result = self.m.python(
64 step_name, 65 step_name,
65 path_to_script, list(args) + [f, self.m.json.output()], 66 path_to_script, list(args) + [f, self.m.json.output()],
66 step_test_data=step_test_data) 67 step_test_data=step_test_data)
67 else: 68 else:
68 step_result = self.m.step( 69 step_result = self.m.step(
69 step_name, 70 step_name,
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 p.logs.update(j.get('logs', {})) 109 p.logs.update(j.get('logs', {}))
109 p.links.update(j.get('links', {})) 110 p.links.update(j.get('links', {}))
110 p.step_summary_text = j.get('step_summary_text', '') 111 p.step_summary_text = j.get('step_summary_text', '')
111 p.step_text = j.get('step_text', '') 112 p.step_text = j.get('step_text', '')
112 p.properties.update(j.get('properties', {})) 113 p.properties.update(j.get('properties', {}))
113 114
114 if failed_steps: 115 if failed_steps:
115 raise self.m.step.StepFailure( 116 raise self.m.step.StepFailure(
116 "the following steps in %s failed: %s" % 117 "the following steps in %s failed: %s" %
117 (step_name, failed_steps)) 118 (step_name, failed_steps))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698