| 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 glob | 6 import glob |
| 7 import json | 7 import json |
| 8 import os | 8 import os |
| 9 import pipes | 9 import pipes |
| 10 import platform | 10 import platform |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 year_to_version = { | 139 year_to_version = { |
| 140 '2013': '12.0', | 140 '2013': '12.0', |
| 141 '2015': '14.0', | 141 '2015': '14.0', |
| 142 '2017': '15.0', | 142 '2017': '15.0', |
| 143 } | 143 } |
| 144 if version_as_year not in year_to_version: | 144 if version_as_year not in year_to_version: |
| 145 raise Exception(('Visual Studio version %s (from GYP_MSVS_VERSION)' | 145 raise Exception(('Visual Studio version %s (from GYP_MSVS_VERSION)' |
| 146 ' not supported. Supported versions are: %s') % ( | 146 ' not supported. Supported versions are: %s') % ( |
| 147 version_as_year, ', '.join(year_to_version.keys()))) | 147 version_as_year, ', '.join(year_to_version.keys()))) |
| 148 version = year_to_version[version_as_year] | 148 version = year_to_version[version_as_year] |
| 149 if version_as_year == '2017': | 149 keys = [r'HKLM\Software\Microsoft\VisualStudio\SxS\VS7', |
| 150 # The VC++ 2017 install location needs to be located using COM instead of | 150 r'HKLM\Software\Wow6432Node\Microsoft\VisualStudio\SxS\VS7'] |
| 151 # the registry. For details see: | 151 for key in keys: |
| 152 # https://blogs.msdn.microsoft.com/heaths/2016/09/15/changes-to-visual-studi
o-15-setup/ | 152 path = _RegistryGetValue(key, version) |
| 153 # For now we use a hardcoded default with an environment variable override. | 153 if not path: |
| 154 path = r'C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional' | 154 continue |
| 155 path = os.environ.get('vs2017_install', path) | 155 path = os.path.normpath(path) |
| 156 if os.path.exists(path): | 156 return path |
| 157 return path | |
| 158 else: | |
| 159 keys = [r'HKLM\Software\Microsoft\VisualStudio\%s' % version, | |
| 160 r'HKLM\Software\Wow6432Node\Microsoft\VisualStudio\%s' % version] | |
| 161 for key in keys: | |
| 162 path = _RegistryGetValue(key, 'InstallDir') | |
| 163 if not path: | |
| 164 continue | |
| 165 path = os.path.normpath(os.path.join(path, '..', '..')) | |
| 166 return path | |
| 167 | 157 |
| 168 raise Exception(('Visual Studio Version %s (from GYP_MSVS_VERSION)' | 158 raise Exception(('Visual Studio Version %s (from GYP_MSVS_VERSION)' |
| 169 ' not found.') % (version_as_year)) | 159 ' not found.') % (version_as_year)) |
| 170 | 160 |
| 171 | 161 |
| 172 def _VersionNumber(): | 162 def _VersionNumber(): |
| 173 """Gets the standard version number ('120', '140', etc.) based on | 163 """Gets the standard version number ('120', '140', etc.) based on |
| 174 GYP_MSVS_VERSION.""" | 164 GYP_MSVS_VERSION.""" |
| 175 vs_version = GetVisualStudioVersion() | 165 vs_version = GetVisualStudioVersion() |
| 176 if vs_version == '2013': | 166 if vs_version == '2013': |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 'copy_dlls': CopyDlls, | 438 'copy_dlls': CopyDlls, |
| 449 } | 439 } |
| 450 if len(sys.argv) < 2 or sys.argv[1] not in commands: | 440 if len(sys.argv) < 2 or sys.argv[1] not in commands: |
| 451 print >>sys.stderr, 'Expected one of: %s' % ', '.join(commands) | 441 print >>sys.stderr, 'Expected one of: %s' % ', '.join(commands) |
| 452 return 1 | 442 return 1 |
| 453 return commands[sys.argv[1]](*sys.argv[2:]) | 443 return commands[sys.argv[1]](*sys.argv[2:]) |
| 454 | 444 |
| 455 | 445 |
| 456 if __name__ == '__main__': | 446 if __name__ == '__main__': |
| 457 sys.exit(main()) | 447 sys.exit(main()) |
| OLD | NEW |