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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 if version_as_year not in year_to_version: | 143 if version_as_year not in year_to_version: |
144 raise Exception(('Visual Studio version %s (from GYP_MSVS_VERSION)' | 144 raise Exception(('Visual Studio version %s (from GYP_MSVS_VERSION)' |
145 ' not supported. Supported versions are: %s') % ( | 145 ' not supported. Supported versions are: %s') % ( |
146 version_as_year, ', '.join(year_to_version.keys()))) | 146 version_as_year, ', '.join(year_to_version.keys()))) |
147 version = year_to_version[version_as_year] | 147 version = year_to_version[version_as_year] |
148 if version_as_year == '2017': | 148 if version_as_year == '2017': |
149 # The VC++ 2017 install location needs to be located using COM instead of | 149 # The VC++ 2017 install location needs to be located using COM instead of |
150 # the registry. For details see: | 150 # the registry. For details see: |
151 # https://blogs.msdn.microsoft.com/heaths/2016/09/15/changes-to-visual-studi
o-15-setup/ | 151 # https://blogs.msdn.microsoft.com/heaths/2016/09/15/changes-to-visual-studi
o-15-setup/ |
152 # For now we use a hardcoded default with an environment variable override. | 152 # For now we use a hardcoded default with an environment variable override. |
153 path = r'C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional' | 153 for path in ( |
154 path = os.environ.get('vs2017_install', path) | 154 os.environ.get('vs2017_install'), |
155 if os.path.exists(path): | 155 r'C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional', |
156 return path | 156 r'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community'): |
| 157 if path and os.path.exists(path): |
| 158 return path |
157 else: | 159 else: |
158 keys = [r'HKLM\Software\Microsoft\VisualStudio\%s' % version, | 160 keys = [r'HKLM\Software\Microsoft\VisualStudio\%s' % version, |
159 r'HKLM\Software\Wow6432Node\Microsoft\VisualStudio\%s' % version] | 161 r'HKLM\Software\Wow6432Node\Microsoft\VisualStudio\%s' % version] |
160 for key in keys: | 162 for key in keys: |
161 path = _RegistryGetValue(key, 'InstallDir') | 163 path = _RegistryGetValue(key, 'InstallDir') |
162 if not path: | 164 if not path: |
163 continue | 165 continue |
164 path = os.path.normpath(os.path.join(path, '..', '..')) | 166 path = os.path.normpath(os.path.join(path, '..', '..')) |
165 return path | 167 return path |
166 | 168 |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 'copy_dlls': CopyDlls, | 413 'copy_dlls': CopyDlls, |
412 } | 414 } |
413 if len(sys.argv) < 2 or sys.argv[1] not in commands: | 415 if len(sys.argv) < 2 or sys.argv[1] not in commands: |
414 print >>sys.stderr, 'Expected one of: %s' % ', '.join(commands) | 416 print >>sys.stderr, 'Expected one of: %s' % ', '.join(commands) |
415 return 1 | 417 return 1 |
416 return commands[sys.argv[1]](*sys.argv[2:]) | 418 return commands[sys.argv[1]](*sys.argv[2:]) |
417 | 419 |
418 | 420 |
419 if __name__ == '__main__': | 421 if __name__ == '__main__': |
420 sys.exit(main()) | 422 sys.exit(main()) |
OLD | NEW |