OLD | NEW |
1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 """Windows can't run .sh files, so this is a Python implementation of | 6 """Windows can't run .sh files, so this is a Python implementation of |
7 update.sh. This script should replace update.sh on all platforms eventually.""" | 7 update.sh. This script should replace update.sh on all platforms eventually.""" |
8 | 8 |
9 import os | 9 import os |
10 import re | 10 import re |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 if os.path.isdir(d): | 129 if os.path.isdir(d): |
130 os.environ['PATH'] = os.environ.get('PATH', '') + os.pathsep + d | 130 os.environ['PATH'] = os.environ.get('PATH', '') + os.pathsep + d |
131 return | 131 return |
132 print 'Failed to find CMake!' | 132 print 'Failed to find CMake!' |
133 sys.exit(1) | 133 sys.exit(1) |
134 | 134 |
135 | 135 |
136 vs_version = None | 136 vs_version = None |
137 def GetVSVersion(): | 137 def GetVSVersion(): |
138 global vs_version | 138 global vs_version |
139 if not vs_version: | 139 if vs_version: |
140 # TODO(hans): Find a less hacky way to find the MSVS installation. | 140 return vs_version |
141 sys.path.append(os.path.join(CHROMIUM_DIR, 'tools', 'gyp', 'pylib')) | 141 |
142 import gyp.MSVSVersion | 142 # Try using the toolchain in depot_tools. |
143 # We request VS 2013 because Clang won't build with 2010, and 2013 will be | 143 # This sets environment variables used by SelectVisualStudioVersion below. |
144 # the default for Chromium soon anyway. | 144 sys.path.append(os.path.join(CHROMIUM_DIR, 'build')) |
145 vs_version = gyp.MSVSVersion.SelectVisualStudioVersion('2013') | 145 import vs_toolchain |
| 146 vs_toolchain.SetEnvironmentAndGetRuntimeDllDirs() |
| 147 |
| 148 # Use gyp to find the MSVS installation, either in depot_tools as per above, |
| 149 # or a system-wide installation otherwise. |
| 150 sys.path.append(os.path.join(CHROMIUM_DIR, 'tools', 'gyp', 'pylib')) |
| 151 import gyp.MSVSVersion |
| 152 vs_version = gyp.MSVSVersion.SelectVisualStudioVersion('2013') |
146 return vs_version | 153 return vs_version |
147 | 154 |
148 | 155 |
149 def UpdateClang(): | 156 def UpdateClang(): |
150 print 'Updating Clang to %s...' % (LLVM_WIN_REVISION) | 157 print 'Updating Clang to %s...' % (LLVM_WIN_REVISION) |
151 if LLVM_WIN_REVISION != 'HEAD' and ReadStampFile() == LLVM_WIN_REVISION: | 158 if LLVM_WIN_REVISION != 'HEAD' and ReadStampFile() == LLVM_WIN_REVISION: |
152 print 'Already up to date.' | 159 print 'Already up to date.' |
153 return 0 | 160 return 0 |
154 | 161 |
155 AddCMakeToPath() | 162 AddCMakeToPath() |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 | 247 |
241 if re.search(r'\b(make_clang_dir)=', os.environ.get('GYP_DEFINES', '')): | 248 if re.search(r'\b(make_clang_dir)=', os.environ.get('GYP_DEFINES', '')): |
242 print 'Skipping Clang update (make_clang_dir= was set in GYP_DEFINES).' | 249 print 'Skipping Clang update (make_clang_dir= was set in GYP_DEFINES).' |
243 return 0 | 250 return 0 |
244 | 251 |
245 return UpdateClang() | 252 return UpdateClang() |
246 | 253 |
247 | 254 |
248 if __name__ == '__main__': | 255 if __name__ == '__main__': |
249 sys.exit(main()) | 256 sys.exit(main()) |
OLD | NEW |