| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright 2015 The Chromium Authors. All rights reserved. | 2 # Copyright 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 """Switch to the given Xcode version. | 6 """Switch to the given Xcode version. |
| 7 | 7 |
| 8 Usage: | 8 Usage: |
| 9 ./find_xcode.py -j /tmp/out.json -v 6.0.1 | 9 ./find_xcode.py -j /tmp/out.json -v 6.0.1 |
| 10 | 10 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 xcodebuild = get_xcodebuild_path(app) | 132 xcodebuild = get_xcodebuild_path(app) |
| 133 | 133 |
| 134 if os.path.exists(xcodebuild): | 134 if os.path.exists(xcodebuild): |
| 135 version, build_version = get_xcode_version(xcodebuild) | 135 version, build_version = get_xcode_version(xcodebuild) |
| 136 | 136 |
| 137 xcode_info['installations'][installation_path] = "%s (%s)" % ( | 137 xcode_info['installations'][installation_path] = "%s (%s)" % ( |
| 138 version, | 138 version, |
| 139 build_version, | 139 build_version, |
| 140 ) | 140 ) |
| 141 | 141 |
| 142 if version == target_version: | 142 # TODO(smut): Remove prefix matching hack when http://crbug.com/461005 |
| 143 xcode_info['matches'][installation_path] = "%s (%s)" % ( | 143 # is fixed. |
| 144 version, | 144 if os.environ.get('BUILDBOT_MASTERNAME') == 'tryserver.chromium.mac': |
| 145 build_version, | 145 if version.startswith(target_version): |
| 146 ) | 146 xcode_info['matches'][installation_path] = "%s (%s)" % ( |
| 147 version, |
| 148 build_version, |
| 149 ) |
| 150 else: |
| 151 if version == target_version: |
| 152 xcode_info['matches'][installation_path] = "%s (%s)" % ( |
| 153 version, |
| 154 build_version, |
| 155 ) |
| 147 | 156 |
| 148 # If this is the first match, switch to it. | 157 # If this is the first match, switch to it. |
| 149 if not xcode_info['found']: | 158 if not xcode_info['found']: |
| 150 utils.call( | 159 utils.call( |
| 151 'sudo', | 160 'sudo', |
| 152 'xcode-select', | 161 'xcode-select', |
| 153 '-switch', | 162 '-switch', |
| 154 os.path.join('/', 'Applications', app), | 163 os.path.join('/', 'Applications', app), |
| 155 ) | 164 ) |
| 156 | 165 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 183 parser.add_argument( | 192 parser.add_argument( |
| 184 '-v', | 193 '-v', |
| 185 '--version', | 194 '--version', |
| 186 help='Xcode version to find and switch to.', | 195 help='Xcode version to find and switch to.', |
| 187 metavar='ver', | 196 metavar='ver', |
| 188 required=True, | 197 required=True, |
| 189 type=str, | 198 type=str, |
| 190 ) | 199 ) |
| 191 | 200 |
| 192 sys.exit(main(parser.parse_args())) | 201 sys.exit(main(parser.parse_args())) |
| OLD | NEW |