| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2016 The Chromium Authors. All rights reserved. | 2 # Copyright 2016 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 If should_use_hermetic_xcode.py emits "1", and the current toolchain is out of | 7 If should_use_hermetic_xcode.py emits "1", and the current toolchain is out of |
| 8 date: | 8 date: |
| 9 * Downloads the hermetic mac toolchain | 9 * Downloads the hermetic mac toolchain |
| 10 * Requires gsutil to be configured. | 10 * Requires gsutil to be configured. |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 build_dir = os.path.join(TOOLCHAIN_BUILD_DIR, 'Contents/Developer') | 150 build_dir = os.path.join(TOOLCHAIN_BUILD_DIR, 'Contents/Developer') |
| 151 subprocess.check_call(['sudo', '/usr/bin/xcode-select', '-s', build_dir]) | 151 subprocess.check_call(['sudo', '/usr/bin/xcode-select', '-s', build_dir]) |
| 152 subprocess.check_call(['sudo', '/usr/bin/xcodebuild', '-license', 'accept']) | 152 subprocess.check_call(['sudo', '/usr/bin/xcodebuild', '-license', 'accept']) |
| 153 finally: | 153 finally: |
| 154 subprocess.check_call(['sudo', '/usr/bin/xcode-select', '-s', old_path]) | 154 subprocess.check_call(['sudo', '/usr/bin/xcode-select', '-s', old_path]) |
| 155 | 155 |
| 156 | 156 |
| 157 def _UseHermeticToolchain(): | 157 def _UseHermeticToolchain(): |
| 158 current_dir = os.path.dirname(os.path.realpath(__file__)) | 158 current_dir = os.path.dirname(os.path.realpath(__file__)) |
| 159 script_path = os.path.join(current_dir, 'mac/should_use_hermetic_xcode.py') | 159 script_path = os.path.join(current_dir, 'mac/should_use_hermetic_xcode.py') |
| 160 proc = subprocess.Popen([script_path], stdout=subprocess.PIPE) | 160 target_os = 'ios' if IsIOSPlatform() else 'mac' |
| 161 proc = subprocess.Popen([script_path, target_os], stdout=subprocess.PIPE) |
| 161 return '1' in proc.stdout.readline() | 162 return '1' in proc.stdout.readline() |
| 162 | 163 |
| 163 | 164 |
| 164 def RequestGsAuthentication(): | 165 def RequestGsAuthentication(): |
| 165 """Requests that the user authenticate to be able to access gs://. | 166 """Requests that the user authenticate to be able to access gs://. |
| 166 """ | 167 """ |
| 167 print 'Access to ' + TOOLCHAIN_URL + ' not configured.' | 168 print 'Access to ' + TOOLCHAIN_URL + ' not configured.' |
| 168 print '-----------------------------------------------------------------' | 169 print '-----------------------------------------------------------------' |
| 169 print | 170 print |
| 170 print 'You appear to be a Googler.' | 171 print 'You appear to be a Googler.' |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 WriteStampFile(toolchain_version) | 230 WriteStampFile(toolchain_version) |
| 230 return 0 | 231 return 0 |
| 231 except Exception as e: | 232 except Exception as e: |
| 232 print 'Failed to download toolchain %s.' % toolchain_file | 233 print 'Failed to download toolchain %s.' % toolchain_file |
| 233 print 'Exception %s' % e | 234 print 'Exception %s' % e |
| 234 print 'Exiting.' | 235 print 'Exiting.' |
| 235 return 1 | 236 return 1 |
| 236 | 237 |
| 237 if __name__ == '__main__': | 238 if __name__ == '__main__': |
| 238 sys.exit(main()) | 239 sys.exit(main()) |
| OLD | NEW |