OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2015 The LUCI Authors. All rights reserved. | 2 # Copyright 2015 The LUCI Authors. All rights reserved. |
3 # Use of this source code is governed under the Apache License, Version 2.0 | 3 # Use of this source code is governed under the Apache License, Version 2.0 |
4 # that can be found in the LICENSE file. | 4 # that can be found in the LICENSE file. |
5 | 5 |
6 """Tool to interact with recipe repositories. | 6 """Tool to interact with recipe repositories. |
7 | 7 |
8 This tool operates on the nearest ancestor directory containing an | 8 This tool operates on the nearest ancestor directory containing an |
9 infra/config/recipes.cfg. | 9 infra/config/recipes.cfg. |
10 """ | 10 """ |
11 | 11 |
12 import argparse | |
13 import json | 12 import json |
14 import logging | 13 import logging |
15 import os | 14 import os |
16 import shutil | 15 import shutil |
17 import subprocess | 16 import subprocess |
18 import sys | 17 import sys |
19 import tempfile | 18 import tempfile |
20 | 19 |
21 # This is necessary to ensure that str literals are by-default assumed to hold | 20 # This is necessary to ensure that str literals are by-default assumed to hold |
22 # utf-8. It also makes the implicit str(unicode(...)) act like | 21 # utf-8. It also makes the implicit str(unicode(...)) act like |
23 # unicode(...).encode('utf-8'), rather than unicode(...).encode('ascii') . | 22 # unicode(...).encode('utf-8'), rather than unicode(...).encode('ascii') . |
24 reload(sys) | 23 reload(sys) |
25 sys.setdefaultencoding('UTF8') | 24 sys.setdefaultencoding('UTF8') |
26 | 25 |
27 ROOT_DIR = os.path.dirname(os.path.abspath(__file__)) | 26 ROOT_DIR = os.path.dirname(os.path.abspath(__file__)) |
28 sys.path.insert(0, ROOT_DIR) | 27 sys.path.insert(0, ROOT_DIR) |
29 | 28 |
30 from recipe_engine import env | 29 from recipe_engine import env |
| 30 |
| 31 import argparse # this is vendored |
31 from recipe_engine import arguments_pb2 | 32 from recipe_engine import arguments_pb2 |
32 from recipe_engine import util as recipe_util | 33 from recipe_engine import util as recipe_util |
33 from google.protobuf import json_format as jsonpb | 34 from google.protobuf import json_format as jsonpb |
34 | 35 |
35 | 36 |
36 def test(config_file, package_deps, args): | 37 def test(config_file, package_deps, args): |
37 try: | 38 try: |
38 from recipe_engine import test | 39 from recipe_engine import test |
39 except ImportError: | 40 except ImportError: |
40 logging.error( | 41 logging.error( |
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
769 | 770 |
770 if not isinstance(ret, int): | 771 if not isinstance(ret, int): |
771 if ret is None: | 772 if ret is None: |
772 ret = 0 | 773 ret = 0 |
773 else: | 774 else: |
774 print >> sys.stderr, ret | 775 print >> sys.stderr, ret |
775 ret = 1 | 776 ret = 1 |
776 sys.stdout.flush() | 777 sys.stdout.flush() |
777 sys.stderr.flush() | 778 sys.stderr.flush() |
778 os._exit(ret) | 779 os._exit(ret) |
OLD | NEW |