Chromium Code Reviews| Index: scripts/slave/recipe_modules/python/api.py |
| diff --git a/scripts/slave/recipe_modules/python/api.py b/scripts/slave/recipe_modules/python/api.py |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..40e3e1ddaa1407b368eca668d4eace63a28dad0b |
| --- /dev/null |
| +++ b/scripts/slave/recipe_modules/python/api.py |
| @@ -0,0 +1,17 @@ |
| +# Copyright 2013 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +from slave import recipe_api |
| + |
| +class PythonApi(recipe_api.RecipeApi): |
| + def __call__(self, name, script, args=None, unbuffered=True, **kwargs): |
| + """Return a step to run a python script with arguments.""" |
| + preamble = ['python'] |
|
agable
2013/06/25 15:55:28
call it 'cmd' or something -- it eventually holds
iannucci
2013/06/25 21:22:09
Done.
|
| + if unbuffered: |
| + preamble.append('-u') |
| + preamble.append(script) |
| + return self.m.step(name, preamble + list(args or []), **kwargs) |
| + |
| + def inline(self, name, program, **kwargs): |
|
agable
2013/06/25 15:55:28
docstring
iannucci
2013/06/25 21:22:09
Good catch. Done.
|
| + return self(name, recipe_api.InputDataPlaceholder(program, '.py'), **kwargs) |