| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2015 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2015 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 """Wrapper for updating and calling infra.git tools. | 7 """Wrapper for updating and calling infra.git tools. |
| 8 | 8 |
| 9 This tool does a two things: | 9 This tool does a two things: |
| 10 * Maintains a infra.git checkout pinned at "deployed" in the home dir | 10 * Maintains a infra.git checkout pinned at "deployed" in the home dir |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 """Ensures that infra.git is present in ~/.chrome-infra.""" | 54 """Ensures that infra.git is present in ~/.chrome-infra.""" |
| 55 print 'Fetching infra into %s, may take a couple of minutes...' % TARGET_DIR | 55 print 'Fetching infra into %s, may take a couple of minutes...' % TARGET_DIR |
| 56 if not os.path.isdir(TARGET_DIR): | 56 if not os.path.isdir(TARGET_DIR): |
| 57 os.mkdir(TARGET_DIR) | 57 os.mkdir(TARGET_DIR) |
| 58 if not os.path.exists(os.path.join(TARGET_DIR, '.gclient')): | 58 if not os.path.exists(os.path.join(TARGET_DIR, '.gclient')): |
| 59 subprocess.check_call( | 59 subprocess.check_call( |
| 60 [sys.executable, os.path.join(SCRIPT_DIR, 'fetch.py'), 'infra'], | 60 [sys.executable, os.path.join(SCRIPT_DIR, 'fetch.py'), 'infra'], |
| 61 cwd=TARGET_DIR, | 61 cwd=TARGET_DIR, |
| 62 stdout=subprocess.PIPE) | 62 stdout=subprocess.PIPE) |
| 63 subprocess.check_call( | 63 subprocess.check_call( |
| 64 [sys.executable, GCLIENT, 'sync', '--revision', 'deployed'], | 64 [sys.executable, GCLIENT, 'sync', '--revision', 'origin/deployed'], |
| 65 cwd=TARGET_DIR, | 65 cwd=TARGET_DIR, |
| 66 stdout=subprocess.PIPE) | 66 stdout=subprocess.PIPE) |
| 67 | 67 |
| 68 | 68 |
| 69 def get_available_tools(): | 69 def get_available_tools(): |
| 70 tools = [] | 70 tools = [] |
| 71 starting = os.path.join(TARGET_DIR, 'infra', 'infra', 'tools') | 71 starting = os.path.join(TARGET_DIR, 'infra', 'infra', 'tools') |
| 72 for root, _, files in os.walk(starting): | 72 for root, _, files in os.walk(starting): |
| 73 if '__main__.py' in files: | 73 if '__main__.py' in files: |
| 74 tools.append(root[len(starting)+1:].replace(os.path.sep, '.')) | 74 tools.append(root[len(starting)+1:].replace(os.path.sep, '.')) |
| (...skipping 20 matching lines...) Expand all Loading... |
| 95 print ' * %s' % tool | 95 print ' * %s' % tool |
| 96 | 96 |
| 97 | 97 |
| 98 def main(): | 98 def main(): |
| 99 if need_to_update(): | 99 if need_to_update(): |
| 100 ensure_infra() | 100 ensure_infra() |
| 101 return run(sys.argv[1:]) | 101 return run(sys.argv[1:]) |
| 102 | 102 |
| 103 if __name__ == '__main__': | 103 if __name__ == '__main__': |
| 104 sys.exit(main()) | 104 sys.exit(main()) |
| OLD | NEW |