OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright 2017 The LUCI Authors. All rights reserved. | 2 # Copyright 2017 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 """ |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 remote, | 80 remote, |
81 ] | 81 ] |
82 | 82 |
83 | 83 |
84 def main(): | 84 def main(): |
85 parser = argparse.ArgumentParser( | 85 parser = argparse.ArgumentParser( |
86 description='Interact with the recipe system.') | 86 description='Interact with the recipe system.') |
87 | 87 |
88 common_postprocess_func = common_args.add_common_args(parser) | 88 common_postprocess_func = common_args.add_common_args(parser) |
89 | 89 |
90 subp = parser.add_subparsers() | 90 subp = parser.add_subparsers(dest='command') |
91 for module in _SUBCOMMANDS: | 91 for module in _SUBCOMMANDS: |
92 module.add_subparser(subp) | 92 module.add_subparser(subp) |
93 | 93 |
94 args = parser.parse_args() | 94 args = parser.parse_args() |
95 common_postprocess_func(parser, args) | 95 common_postprocess_func(parser, args) |
96 args.postprocess_func(parser, args) | 96 args.postprocess_func(parser, args) |
97 | 97 |
98 # If we're bootstrapping, construct our bootstrap environment. If we're | 98 # If we're bootstrapping, construct our bootstrap environment. If we're |
99 # using a custom deps path, install our enviornment there too. | 99 # using a custom deps path, install our enviornment there too. |
100 if args.use_bootstrap and not env.USING_BOOTSTRAP: | 100 if args.use_bootstrap and not env.USING_BOOTSTRAP: |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 | 163 |
164 if not isinstance(ret, int): | 164 if not isinstance(ret, int): |
165 if ret is None: | 165 if ret is None: |
166 ret = 0 | 166 ret = 0 |
167 else: | 167 else: |
168 print >> sys.stderr, ret | 168 print >> sys.stderr, ret |
169 ret = 1 | 169 ret = 1 |
170 sys.stdout.flush() | 170 sys.stdout.flush() |
171 sys.stderr.flush() | 171 sys.stderr.flush() |
172 os._exit(ret) | 172 os._exit(ret) |
OLD | NEW |