| 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 26 matching lines...) Expand all  Loading... | 
|   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: |   43   else: | 
|   44     return None |   44     return None | 
|   45  |   45  | 
|   46  |   46  | 
 |   47 def SetToolchainEnvironment(): | 
 |   48   mac_toolchain_dir = GetToolchainDirectory() | 
 |   49   if mac_toolchain_dir: | 
 |   50     os.environ['DEVELOPER_DIR'] = mac_toolchain_dir | 
 |   51  | 
 |   52  | 
|   47 def ReadStampFile(): |   53 def ReadStampFile(): | 
|   48   """Return the contents of the stamp file, or '' if it doesn't exist.""" |   54   """Return the contents of the stamp file, or '' if it doesn't exist.""" | 
|   49   try: |   55   try: | 
|   50     with open(STAMP_FILE, 'r') as f: |   56     with open(STAMP_FILE, 'r') as f: | 
|   51       return f.read().rstrip() |   57       return f.read().rstrip() | 
|   52   except IOError: |   58   except IOError: | 
|   53     return '' |   59     return '' | 
|   54  |   60  | 
|   55  |   61  | 
|   56 def WriteStampFile(s): |   62 def WriteStampFile(s): | 
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  147     print 'Toolchain %s unpacked.' % toolchain_revision |  153     print 'Toolchain %s unpacked.' % toolchain_revision | 
|  148     WriteStampFile(toolchain_revision) |  154     WriteStampFile(toolchain_revision) | 
|  149     return 0 |  155     return 0 | 
|  150   except: |  156   except: | 
|  151     print 'Failed to download toolchain %s.' % toolchain_file |  157     print 'Failed to download toolchain %s.' % toolchain_file | 
|  152     print 'Exiting.' |  158     print 'Exiting.' | 
|  153     return 1 |  159     return 1 | 
|  154  |  160  | 
|  155 if __name__ == '__main__': |  161 if __name__ == '__main__': | 
|  156   sys.exit(main()) |  162   sys.exit(main()) | 
| OLD | NEW |