Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright 2014 The Chromium Authors. All rights reserved. | 2 # Copyright 2014 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 import json | 6 import json |
| 7 import os | 7 import os |
| 8 import pipes | 8 import pipes |
| 9 import shutil | 9 import shutil |
| 10 import subprocess | 10 import subprocess |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 26 returns the location of the VS runtime DLLs so they can be copied into | 26 returns the location of the VS runtime DLLs so they can be copied into |
| 27 the output directory after gyp generation. | 27 the output directory after gyp generation. |
| 28 """ | 28 """ |
| 29 vs_runtime_dll_dirs = None | 29 vs_runtime_dll_dirs = None |
| 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 # When running on a non-Windows host, only do this if the SDK has explicitly | 32 # When running on a non-Windows host, only do this if the SDK has explicitly |
| 33 # been downloaded before (in which case json_data_file will exist). | 33 # been downloaded before (in which case json_data_file will exist). |
| 34 if ((sys.platform in ('win32', 'cygwin') or os.path.exists(json_data_file)) | 34 if ((sys.platform in ('win32', 'cygwin') or os.path.exists(json_data_file)) |
| 35 and depot_tools_win_toolchain): | 35 and depot_tools_win_toolchain): |
| 36 if not os.path.exists(json_data_file): | 36 if not os.path.exists(json_data_file): |
|
scottmg
2016/01/15 01:05:19
I don't think overriding the version that's coming
| |
| 37 Update() | 37 Update() |
| 38 with open(json_data_file, 'r') as tempf: | 38 with open(json_data_file, 'r') as tempf: |
| 39 toolchain_data = json.load(tempf) | 39 toolchain_data = json.load(tempf) |
| 40 | 40 |
| 41 toolchain = toolchain_data['path'] | 41 toolchain = toolchain_data['path'] |
| 42 version = toolchain_data['version'] | 42 version = toolchain_data['version'] |
| 43 win_sdk = toolchain_data.get('win_sdk') | 43 win_sdk = toolchain_data.get('win_sdk') |
| 44 if not win_sdk: | 44 if not win_sdk: |
| 45 win_sdk = toolchain_data['win8sdk'] | 45 win_sdk = toolchain_data['win8sdk'] |
| 46 wdk = toolchain_data['wdk'] | 46 wdk = toolchain_data['wdk'] |
| 47 # TODO(scottmg): The order unfortunately matters in these. They should be | 47 # TODO(scottmg): The order unfortunately matters in these. They should be |
| 48 # split into separate keys for x86 and x64. (See CopyVsRuntimeDlls call | 48 # split into separate keys for x86 and x64. (See CopyVsRuntimeDlls call |
| 49 # below). http://crbug.com/345992 | 49 # below). http://crbug.com/345992 |
| 50 vs_runtime_dll_dirs = toolchain_data['runtime_dirs'] | 50 vs_runtime_dll_dirs = toolchain_data['runtime_dirs'] |
| 51 | 51 |
| 52 os.environ['GYP_MSVS_OVERRIDE_PATH'] = toolchain | 52 os.environ['GYP_MSVS_OVERRIDE_PATH'] = toolchain |
| 53 os.environ['GYP_MSVS_VERSION'] = version | 53 if os.getenv('GYP_MSVS_VERSION'): |
| 54 print ('Using the GYP_MSVS_VERSION value from the environment (%d).' % | |
| 55 os.getenv('GYP_MSVS_VERSION')) | |
| 56 else: | |
| 57 os.environ['GYP_MSVS_VERSION'] = version | |
| 54 # We need to make sure windows_sdk_path is set to the automated | 58 # We need to make sure windows_sdk_path is set to the automated |
| 55 # toolchain values in GYP_DEFINES, but don't want to override any | 59 # toolchain values in GYP_DEFINES, but don't want to override any |
| 56 # otheroptions.express | 60 # otheroptions.express |
| 57 # values there. | 61 # values there. |
| 58 gyp_defines_dict = gyp.NameValueListToDict(gyp.ShlexEnv('GYP_DEFINES')) | 62 gyp_defines_dict = gyp.NameValueListToDict(gyp.ShlexEnv('GYP_DEFINES')) |
| 59 gyp_defines_dict['windows_sdk_path'] = win_sdk | 63 gyp_defines_dict['windows_sdk_path'] = win_sdk |
| 60 os.environ['GYP_DEFINES'] = ' '.join('%s=%s' % (k, pipes.quote(str(v))) | 64 os.environ['GYP_DEFINES'] = ' '.join('%s=%s' % (k, pipes.quote(str(v))) |
| 61 for k, v in gyp_defines_dict.iteritems()) | 65 for k, v in gyp_defines_dict.iteritems()) |
| 62 os.environ['WINDOWSSDKDIR'] = win_sdk | 66 os.environ['WINDOWSSDKDIR'] = win_sdk |
| 63 os.environ['WDK_DIR'] = wdk | 67 os.environ['WDK_DIR'] = wdk |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 330 'copy_dlls': CopyDlls, | 334 'copy_dlls': CopyDlls, |
| 331 } | 335 } |
| 332 if len(sys.argv) < 2 or sys.argv[1] not in commands: | 336 if len(sys.argv) < 2 or sys.argv[1] not in commands: |
| 333 print >>sys.stderr, 'Expected one of: %s' % ', '.join(commands) | 337 print >>sys.stderr, 'Expected one of: %s' % ', '.join(commands) |
| 334 return 1 | 338 return 1 |
| 335 return commands[sys.argv[1]](*sys.argv[2:]) | 339 return commands[sys.argv[1]](*sys.argv[2:]) |
| 336 | 340 |
| 337 | 341 |
| 338 if __name__ == '__main__': | 342 if __name__ == '__main__': |
| 339 sys.exit(main()) | 343 sys.exit(main()) |
| OLD | NEW |