Chromium Code Reviews| Index: recipe_engine/remote_run.py |
| diff --git a/recipe_engine/remote_run.py b/recipe_engine/remote_run.py |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..76251a8d0654c82146384143f8111bbe19981f7d |
| --- /dev/null |
| +++ b/recipe_engine/remote_run.py |
| @@ -0,0 +1,44 @@ |
| +# Copyright 2016 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 __future__ import print_function |
| + |
| +import logging |
| +import os |
| +import shutil |
| +import subprocess |
| +import sys |
| +import tempfile |
| + |
| +from recipe_engine import fetch |
| +from recipe_engine import package |
| + |
| + |
| +def real_main(args): |
| + checkout_dir = os.path.join(args.workdir, 'checkout') |
| + fetch.fetch_from_git(args.repository, args.revision, checkout_dir, |
| + allow_fetch=True) |
| + proto_file = package.ProtoFile( |
| + package.InfraRepoConfig().to_recipes_cfg(checkout_dir)) |
| + cmd = [ |
|
martiniss
2016/05/20 17:56:31
My original design here had been to just do the fe
Paweł Hajdan Jr.
2016/05/20 21:59:57
Given it's going to be the entry point replacing k
|
| + sys.executable, |
| + os.path.join(checkout_dir, proto_file.read().recipes_path, 'recipes.py'), |
|
iannucci1
2016/05/20 18:04:22
s/proto_file/recipes_cfg ?
proto_file will get co
Paweł Hajdan Jr.
2016/05/20 21:59:57
Done.
|
| + 'run' |
| + ] + args.run_args |
| + logging.info('Running %r', cmd) |
| + return subprocess.call(cmd) |
| + |
| + |
| +def main(args): |
| + workdir_tempdir = False |
| + if not args.workdir: |
| + workdir_tempdir = True |
| + args.workdir = tempfile.mkdtemp(prefix='recipe_engine_remote_run_') |
| + logging.info('Created temporary workdir %s', args.workdir) |
| + |
| + try: |
| + return real_main(args) |
| + finally: |
| + if workdir_tempdir: |
| + shutil.rmtree(args.workdir) |
|
iannucci1
2016/05/20 18:04:22
ignore errors?
Paweł Hajdan Jr.
2016/05/20 21:59:57
Done.
|