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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 55 |
56 def init(self): | 56 def init(self): |
57 pass | 57 pass |
58 | 58 |
59 def sync(self): | 59 def sync(self): |
60 pass | 60 pass |
61 | 61 |
62 def run(self, cmd, **kwargs): | 62 def run(self, cmd, **kwargs): |
63 print 'Running: %s' % (' '.join(pipes.quote(x) for x in cmd)) | 63 print 'Running: %s' % (' '.join(pipes.quote(x) for x in cmd)) |
64 if self.options.dry_run: | 64 if self.options.dry_run: |
65 return 0 | 65 return '' |
66 return subprocess.check_output(cmd, **kwargs) | 66 return subprocess.check_output(cmd, **kwargs) |
67 | 67 |
68 | 68 |
69 class GclientCheckout(Checkout): | 69 class GclientCheckout(Checkout): |
70 | 70 |
71 def run_gclient(self, *cmd, **kwargs): | 71 def run_gclient(self, *cmd, **kwargs): |
72 if not spawn.find_executable('gclient'): | 72 if not spawn.find_executable('gclient'): |
73 cmd_prefix = (sys.executable, os.path.join(SCRIPT_PATH, 'gclient.py')) | 73 cmd_prefix = (sys.executable, os.path.join(SCRIPT_PATH, 'gclient.py')) |
74 else: | 74 else: |
75 cmd_prefix = ('gclient',) | 75 cmd_prefix = ('gclient',) |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 spec, root = run_recipe_fetch(recipe, props) | 336 spec, root = run_recipe_fetch(recipe, props) |
337 return run(options, spec, root) | 337 return run(options, spec, root) |
338 | 338 |
339 | 339 |
340 if __name__ == '__main__': | 340 if __name__ == '__main__': |
341 try: | 341 try: |
342 sys.exit(main()) | 342 sys.exit(main()) |
343 except KeyboardInterrupt: | 343 except KeyboardInterrupt: |
344 sys.stderr.write('interrupted\n') | 344 sys.stderr.write('interrupted\n') |
345 sys.exit(1) | 345 sys.exit(1) |
OLD | NEW |