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 json | |
scottmg
2014/09/22 19:54:51
unneeded now
| |
9 import os | 10 import os |
10 import re | 11 import re |
11 import shutil | 12 import shutil |
12 import subprocess | 13 import subprocess |
13 import sys | 14 import sys |
14 | 15 |
15 # Do NOT CHANGE this if you don't know what you're doing -- see | 16 # Do NOT CHANGE this if you don't know what you're doing -- see |
16 # https://code.google.com/p/chromium/wiki/UpdatingClang | 17 # https://code.google.com/p/chromium/wiki/UpdatingClang |
17 # Reverting problematic clang rolls is safe, though. | 18 # Reverting problematic clang rolls is safe, though. |
18 # Note: this revision is only used for Windows. Other platforms use update.sh. | 19 # Note: this revision is only used for Windows. Other platforms use update.sh. |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
129 if os.path.isdir(d): | 130 if os.path.isdir(d): |
130 os.environ['PATH'] = os.environ.get('PATH', '') + os.pathsep + d | 131 os.environ['PATH'] = os.environ.get('PATH', '') + os.pathsep + d |
131 return | 132 return |
132 print 'Failed to find CMake!' | 133 print 'Failed to find CMake!' |
133 sys.exit(1) | 134 sys.exit(1) |
134 | 135 |
135 | 136 |
136 vs_version = None | 137 vs_version = None |
137 def GetVSVersion(): | 138 def GetVSVersion(): |
138 global vs_version | 139 global vs_version |
139 if not vs_version: | 140 if vs_version: |
140 # TODO(hans): Find a less hacky way to find the MSVS installation. | 141 return vs_version |
141 sys.path.append(os.path.join(CHROMIUM_DIR, 'tools', 'gyp', 'pylib')) | 142 |
142 import gyp.MSVSVersion | 143 # Try using the toolchain in depot_tools. |
143 # We request VS 2013 because Clang won't build with 2010, and 2013 will be | 144 # This sets environment variables used by SelectVisualStudioVersion below. |
144 # the default for Chromium soon anyway. | 145 sys.path.append(os.path.join(CHROMIUM_DIR, 'build')) |
145 vs_version = gyp.MSVSVersion.SelectVisualStudioVersion('2013') | 146 import vs_toolchain |
147 vs_toolchain.SetEnvironmentAndGetRuntimeDllDirs() | |
148 | |
149 # Use gyp to find the MSVS installation, either in depot_tools as per above, | |
150 # or a system-wide installation otherwise. | |
151 sys.path.append(os.path.join(CHROMIUM_DIR, 'tools', 'gyp', 'pylib')) | |
152 import gyp.MSVSVersion | |
153 vs_version = gyp.MSVSVersion.SelectVisualStudioVersion('2013') | |
146 return vs_version | 154 return vs_version |
147 | 155 |
148 | 156 |
149 def UpdateClang(): | 157 def UpdateClang(): |
150 print 'Updating Clang to %s...' % (LLVM_WIN_REVISION) | 158 print 'Updating Clang to %s...' % (LLVM_WIN_REVISION) |
151 if LLVM_WIN_REVISION != 'HEAD' and ReadStampFile() == LLVM_WIN_REVISION: | 159 if LLVM_WIN_REVISION != 'HEAD' and ReadStampFile() == LLVM_WIN_REVISION: |
152 print 'Already up to date.' | 160 print 'Already up to date.' |
153 return 0 | 161 return 0 |
154 | 162 |
155 AddCMakeToPath() | 163 AddCMakeToPath() |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
240 | 248 |
241 if re.search(r'\b(make_clang_dir)=', os.environ.get('GYP_DEFINES', '')): | 249 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).' | 250 print 'Skipping Clang update (make_clang_dir= was set in GYP_DEFINES).' |
243 return 0 | 251 return 0 |
244 | 252 |
245 return UpdateClang() | 253 return UpdateClang() |
246 | 254 |
247 | 255 |
248 if __name__ == '__main__': | 256 if __name__ == '__main__': |
249 sys.exit(main()) | 257 sys.exit(main()) |
OLD | NEW |