OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import json | 5 import json |
6 import os | 6 import os |
7 import pipes | 7 import pipes |
8 import shutil | 8 import shutil |
9 import subprocess | 9 import subprocess |
10 import sys | 10 import sys |
(...skipping 19 matching lines...) Expand all Loading... |
30 depot_tools_win_toolchain = \ | 30 depot_tools_win_toolchain = \ |
31 bool(int(os.environ.get('DEPOT_TOOLS_WIN_TOOLCHAIN', '1'))) | 31 bool(int(os.environ.get('DEPOT_TOOLS_WIN_TOOLCHAIN', '1'))) |
32 if sys.platform in ('win32', 'cygwin') and depot_tools_win_toolchain: | 32 if sys.platform in ('win32', 'cygwin') and depot_tools_win_toolchain: |
33 if not os.path.exists(json_data_file): | 33 if not os.path.exists(json_data_file): |
34 Update() | 34 Update() |
35 with open(json_data_file, 'r') as tempf: | 35 with open(json_data_file, 'r') as tempf: |
36 toolchain_data = json.load(tempf) | 36 toolchain_data = json.load(tempf) |
37 | 37 |
38 toolchain = toolchain_data['path'] | 38 toolchain = toolchain_data['path'] |
39 version = toolchain_data['version'] | 39 version = toolchain_data['version'] |
40 version_is_pro = version[-1] != 'e' | |
41 win8sdk = toolchain_data['win8sdk'] | 40 win8sdk = toolchain_data['win8sdk'] |
42 wdk = toolchain_data['wdk'] | 41 wdk = toolchain_data['wdk'] |
43 # TODO(scottmg): The order unfortunately matters in these. They should be | 42 # TODO(scottmg): The order unfortunately matters in these. They should be |
44 # split into separate keys for x86 and x64. (See CopyVsRuntimeDlls call | 43 # split into separate keys for x86 and x64. (See CopyVsRuntimeDlls call |
45 # below). http://crbug.com/345992 | 44 # below). http://crbug.com/345992 |
46 vs2013_runtime_dll_dirs = toolchain_data['runtime_dirs'] | 45 vs2013_runtime_dll_dirs = toolchain_data['runtime_dirs'] |
47 | 46 |
48 os.environ['GYP_MSVS_OVERRIDE_PATH'] = toolchain | 47 os.environ['GYP_MSVS_OVERRIDE_PATH'] = toolchain |
49 os.environ['GYP_MSVS_VERSION'] = version | 48 os.environ['GYP_MSVS_VERSION'] = version |
50 # We need to make sure windows_sdk_path is set to the automated | 49 # We need to make sure windows_sdk_path is set to the automated |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 def Update(): | 160 def Update(): |
162 """Requests an update of the toolchain to the specific hashes we have at | 161 """Requests an update of the toolchain to the specific hashes we have at |
163 this revision. The update outputs a .json of the various configuration | 162 this revision. The update outputs a .json of the various configuration |
164 information required to pass to gyp which we use in |GetToolchainDir()|. | 163 information required to pass to gyp which we use in |GetToolchainDir()|. |
165 """ | 164 """ |
166 depot_tools_win_toolchain = \ | 165 depot_tools_win_toolchain = \ |
167 bool(int(os.environ.get('DEPOT_TOOLS_WIN_TOOLCHAIN', '1'))) | 166 bool(int(os.environ.get('DEPOT_TOOLS_WIN_TOOLCHAIN', '1'))) |
168 if sys.platform in ('win32', 'cygwin') and depot_tools_win_toolchain: | 167 if sys.platform in ('win32', 'cygwin') and depot_tools_win_toolchain: |
169 import find_depot_tools | 168 import find_depot_tools |
170 depot_tools_path = find_depot_tools.add_depot_tools_to_path() | 169 depot_tools_path = find_depot_tools.add_depot_tools_to_path() |
171 json_data_file = os.path.join(script_dir, 'win_toolchain.json') | |
172 get_toolchain_args = [ | 170 get_toolchain_args = [ |
173 sys.executable, | 171 sys.executable, |
174 os.path.join(depot_tools_path, | 172 os.path.join(depot_tools_path, |
175 'win_toolchain', | 173 'win_toolchain', |
176 'get_toolchain_if_necessary.py'), | 174 'get_toolchain_if_necessary.py'), |
177 '--output-json', json_data_file, | 175 '--output-json', json_data_file, |
178 ] + _GetDesiredVsToolchainHashes() | 176 ] + _GetDesiredVsToolchainHashes() |
179 subprocess.check_call(get_toolchain_args) | 177 subprocess.check_call(get_toolchain_args) |
180 | 178 |
181 return 0 | 179 return 0 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 'copy_dlls': CopyDlls, | 212 'copy_dlls': CopyDlls, |
215 } | 213 } |
216 if len(sys.argv) < 2 or sys.argv[1] not in commands: | 214 if len(sys.argv) < 2 or sys.argv[1] not in commands: |
217 print >>sys.stderr, 'Expected one of: %s' % ', '.join(commands) | 215 print >>sys.stderr, 'Expected one of: %s' % ', '.join(commands) |
218 return 1 | 216 return 1 |
219 return commands[sys.argv[1]](*sys.argv[2:]) | 217 return commands[sys.argv[1]](*sys.argv[2:]) |
220 | 218 |
221 | 219 |
222 if __name__ == '__main__': | 220 if __name__ == '__main__': |
223 sys.exit(main()) | 221 sys.exit(main()) |
OLD | NEW |