| 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 """Download necessary mac toolchain files under certain conditions. If | 6 """Download necessary mac toolchain files under certain conditions. If |
| 7 xcode-select is already set and points to an external folder | 7 xcode-select is already set and points to an external folder |
| 8 (e.g. /Application/Xcode.app), this script only runs if the GYP_DEFINE | 8 (e.g. /Application/Xcode.app), this script only runs if the GYP_DEFINE |
| 9 |force_mac_toolchain| is set. To override the values in | 9 |force_mac_toolchain| is set. To override the values in |
| 10 |TOOLCHAIN_REVISION|-|TOOLCHAIN_SUB_REVISION| below, GYP_DEFINE | 10 |TOOLCHAIN_REVISION|-|TOOLCHAIN_SUB_REVISION| below, GYP_DEFINE |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 BASE_DIR = os.path.abspath(os.path.dirname(__file__)) | 34 BASE_DIR = os.path.abspath(os.path.dirname(__file__)) |
| 35 TOOLCHAIN_BUILD_DIR = os.path.join(BASE_DIR, 'mac_files', 'Xcode.app') | 35 TOOLCHAIN_BUILD_DIR = os.path.join(BASE_DIR, 'mac_files', 'Xcode.app') |
| 36 STAMP_FILE = os.path.join(BASE_DIR, 'mac_files', 'toolchain_build_revision') | 36 STAMP_FILE = os.path.join(BASE_DIR, 'mac_files', 'toolchain_build_revision') |
| 37 TOOLCHAIN_URL = 'gs://chrome-mac-sdk/' | 37 TOOLCHAIN_URL = 'gs://chrome-mac-sdk/' |
| 38 | 38 |
| 39 | 39 |
| 40 def GetToolchainDirectory(): | 40 def GetToolchainDirectory(): |
| 41 if sys.platform == 'darwin' and not UseLocalMacSDK(): | 41 if sys.platform == 'darwin' and not UseLocalMacSDK(): |
| 42 return TOOLCHAIN_BUILD_DIR | 42 return TOOLCHAIN_BUILD_DIR |
| 43 else: |
| 44 return None |
| 43 | 45 |
| 44 | 46 |
| 45 def ReadStampFile(): | 47 def ReadStampFile(): |
| 46 """Return the contents of the stamp file, or '' if it doesn't exist.""" | 48 """Return the contents of the stamp file, or '' if it doesn't exist.""" |
| 47 try: | 49 try: |
| 48 with open(STAMP_FILE, 'r') as f: | 50 with open(STAMP_FILE, 'r') as f: |
| 49 return f.read().rstrip() | 51 return f.read().rstrip() |
| 50 except IOError: | 52 except IOError: |
| 51 return '' | 53 return '' |
| 52 | 54 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 print 'Toolchain %s unpacked.' % toolchain_revision | 147 print 'Toolchain %s unpacked.' % toolchain_revision |
| 146 WriteStampFile(toolchain_revision) | 148 WriteStampFile(toolchain_revision) |
| 147 return 0 | 149 return 0 |
| 148 except: | 150 except: |
| 149 print 'Failed to download toolchain %s.' % toolchain_file | 151 print 'Failed to download toolchain %s.' % toolchain_file |
| 150 print 'Exiting.' | 152 print 'Exiting.' |
| 151 return 1 | 153 return 1 |
| 152 | 154 |
| 153 if __name__ == '__main__': | 155 if __name__ == '__main__': |
| 154 sys.exit(main()) | 156 sys.exit(main()) |
| OLD | NEW |