| 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 """ | 6 """ |
| 7 Tool to perform checkouts in one easy command line! | 7 Tool to perform checkouts in one easy command line! |
| 8 | 8 |
| 9 Usage: | 9 Usage: |
| 10 fetch <recipe> [--property=value [--property2=value2 ...]] | 10 fetch <recipe> [--property=value [--property2=value2 ...]] |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 http://www.chromium.org/developers/how-tos/get-the-code | 228 http://www.chromium.org/developers/how-tos/get-the-code |
| 229 for full usage instructions. | 229 for full usage instructions. |
| 230 | 230 |
| 231 Valid options: | 231 Valid options: |
| 232 -h, --help, help Print this message. | 232 -h, --help, help Print this message. |
| 233 --nohooks Don't run hooks after checkout. | 233 --nohooks Don't run hooks after checkout. |
| 234 -n, --dry-run Don't run commands, only print them. | 234 -n, --dry-run Don't run commands, only print them. |
| 235 --no-history Perform shallow clones, don't fetch the full git histo
ry. | 235 --no-history Perform shallow clones, don't fetch the full git histo
ry. |
| 236 | 236 |
| 237 Valid fetch recipes:""") % os.path.basename(sys.argv[0]) | 237 Valid fetch recipes:""") % os.path.basename(sys.argv[0]) |
| 238 for fname in os.listdir(os.path.join(SCRIPT_PATH, 'recipes')): | 238 |
| 239 if fname.endswith('.py'): | 239 recipes_dir = os.path.join(SCRIPT_PATH, 'recipes') |
| 240 print ' ' + fname[:-3] | 240 recipes = [f[:-3] for f in os.listdir(recipes_dir) if f.endswith('.py')] |
| 241 recipes.sort() |
| 242 for fname in recipes: |
| 243 print ' ' + fname |
| 241 | 244 |
| 242 sys.exit(bool(msg)) | 245 sys.exit(bool(msg)) |
| 243 | 246 |
| 244 | 247 |
| 245 def handle_args(argv): | 248 def handle_args(argv): |
| 246 """Gets the recipe name from the command line arguments.""" | 249 """Gets the recipe name from the command line arguments.""" |
| 247 if len(argv) <= 1: | 250 if len(argv) <= 1: |
| 248 usage('Must specify a recipe.') | 251 usage('Must specify a recipe.') |
| 249 if argv[1] in ('-h', '--help', 'help'): | 252 if argv[1] in ('-h', '--help', 'help'): |
| 250 usage() | 253 usage() |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 spec, root = run_recipe_fetch(recipe, props) | 339 spec, root = run_recipe_fetch(recipe, props) |
| 337 return run(options, spec, root) | 340 return run(options, spec, root) |
| 338 | 341 |
| 339 | 342 |
| 340 if __name__ == '__main__': | 343 if __name__ == '__main__': |
| 341 try: | 344 try: |
| 342 sys.exit(main()) | 345 sys.exit(main()) |
| 343 except KeyboardInterrupt: | 346 except KeyboardInterrupt: |
| 344 sys.stderr.write('interrupted\n') | 347 sys.stderr.write('interrupted\n') |
| 345 sys.exit(1) | 348 sys.exit(1) |
| OLD | NEW |