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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 cwd=TARGET_DIR, | 70 cwd=TARGET_DIR, |
71 stdout=subprocess.PIPE) | 71 stdout=subprocess.PIPE) |
72 | 72 |
73 | 73 |
74 def get_available_tools(): | 74 def get_available_tools(): |
75 tools = [] | 75 tools = [] |
76 starting = os.path.join(TARGET_DIR, 'infra', 'infra', 'tools') | 76 starting = os.path.join(TARGET_DIR, 'infra', 'infra', 'tools') |
77 for root, _, files in os.walk(starting): | 77 for root, _, files in os.walk(starting): |
78 if '__main__.py' in files: | 78 if '__main__.py' in files: |
79 tools.append(root[len(starting)+1:].replace(os.path.sep, '.')) | 79 tools.append(root[len(starting)+1:].replace(os.path.sep, '.')) |
80 return tools | 80 return sorted(tools) |
81 | 81 |
82 | 82 |
83 def run(args): | 83 def run(args): |
84 if args: | 84 if args: |
85 tool_name = args[0] | 85 tool_name = args[0] |
86 cmd = [ | 86 cmd = [ |
87 sys.executable, os.path.join(TARGET_DIR, 'infra', 'run.py'), | 87 sys.executable, os.path.join(TARGET_DIR, 'infra', 'run.py'), |
88 'infra.tools.%s' % tool_name] | 88 'infra.tools.%s' % tool_name] |
89 cmd.extend(args[1:]) | 89 cmd.extend(args[1:]) |
90 return subprocess.call(cmd) | 90 return subprocess.call(cmd) |
(...skipping 20 matching lines...) Expand all Loading... |
111 args.args.pop(0) | 111 args.args.pop(0) |
112 if extras: | 112 if extras: |
113 args.args = extras + args.args | 113 args.args = extras + args.args |
114 | 114 |
115 if need_to_update(args.infra_branch): | 115 if need_to_update(args.infra_branch): |
116 ensure_infra(args.infra_branch) | 116 ensure_infra(args.infra_branch) |
117 return run(args.args) | 117 return run(args.args) |
118 | 118 |
119 if __name__ == '__main__': | 119 if __name__ == '__main__': |
120 sys.exit(main()) | 120 sys.exit(main()) |
OLD | NEW |