OLD | NEW |
---|---|
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2013 The Chromium Authors. All rights reserved. |
3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
5 | 5 |
6 import contextlib | 6 import contextlib |
7 import json | 7 import json |
8 import optparse | 8 import optparse |
9 import os | 9 import os |
10 import subprocess | 10 import subprocess |
11 import sys | 11 import sys |
12 import tempfile | 12 import tempfile |
13 | 13 |
14 BUILD_ROOT = os.path.dirname(os.path.dirname(os.path.dirname( | 14 BUILD_ROOT = os.path.dirname(os.path.dirname(os.path.dirname( |
15 os.path.abspath(__file__)))) | 15 os.path.abspath(__file__)))) |
16 sys.path.append(os.path.join(BUILD_ROOT, 'scripts')) | 16 sys.path.append(os.path.join(BUILD_ROOT, 'scripts')) |
17 sys.path.append(os.path.join(BUILD_ROOT, 'third_party')) | 17 sys.path.append(os.path.join(BUILD_ROOT, 'third_party')) |
18 | 18 |
19 from common import annotator | 19 from common import annotator |
20 from common import chromium_utils | 20 from common import chromium_utils |
21 from common import master_cfg_utils | 21 from common import master_cfg_utils |
22 from slave import recipe_universe | |
23 | 22 |
23 from recipe_engine import loader | |
24 from recipe_engine import main as recipe_main | 24 from recipe_engine import main as recipe_main |
25 from recipe_engine import package | |
26 | |
27 PACKAGE_PYL = os.path.join( | |
luqui
2015/08/06 20:57:57
Oops. TODO: fix this script and write a test for
luqui
2015/08/20 22:45:23
Done
| |
28 os.path.dirname(os.path.abspath(__file__)), 'recipe_package.pyl') | |
25 | 29 |
26 @contextlib.contextmanager | 30 @contextlib.contextmanager |
27 def namedTempFile(): | 31 def namedTempFile(): |
28 fd, name = tempfile.mkstemp() | 32 fd, name = tempfile.mkstemp() |
29 os.close(fd) # let the exceptions fly | 33 os.close(fd) # let the exceptions fly |
30 try: | 34 try: |
31 yield name | 35 yield name |
32 finally: | 36 finally: |
33 try: | 37 try: |
34 os.remove(name) | 38 os.remove(name) |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
196 | 200 |
197 return True | 201 return True |
198 | 202 |
199 | 203 |
200 def main(argv): | 204 def main(argv): |
201 opts, _ = get_args(argv) | 205 opts, _ = get_args(argv) |
202 properties = get_recipe_properties( | 206 properties = get_recipe_properties( |
203 opts.factory_properties, opts.build_properties, | 207 opts.factory_properties, opts.build_properties, |
204 opts.master_overrides_slave) | 208 opts.master_overrides_slave) |
205 stream = annotator.StructuredAnnotationStream() | 209 stream = annotator.StructuredAnnotationStream() |
206 ret = recipe_main.run_steps(properties, stream, | 210 universe = loader.RecipeUniverse(package.PackageDeps.create(PACKAGE_PYL)) |
207 universe=recipe_universe.get_universe()) | 211 ret = recipe_main.run_steps(properties, stream, universe=universe) |
208 return ret.status_code | 212 return ret.status_code |
209 | 213 |
210 | 214 |
211 def shell_main(argv): | 215 def shell_main(argv): |
212 if update_scripts(): | 216 if update_scripts(): |
213 return subprocess.call([sys.executable] + argv) | 217 return subprocess.call([sys.executable] + argv) |
214 else: | 218 else: |
215 return main(argv) | 219 return main(argv) |
216 | 220 |
217 if __name__ == '__main__': | 221 if __name__ == '__main__': |
218 sys.exit(shell_main(sys.argv)) | 222 sys.exit(shell_main(sys.argv)) |
OLD | NEW |