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 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 path = r'C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional' |
|
scottmg
2017/04/12 17:00:48
Instead of duplicating the check, how about:
for
| |
| 154 path = os.environ.get('vs2017_install', path) | 154 path = os.environ.get('vs2017_install', path) |
| 155 if os.path.exists(path): | 155 if os.path.exists(path): |
| 156 return path | 156 return path |
| 157 # Try MSVS 2017 Community edition. | |
| 158 path = r'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community' | |
| 159 if os.path.exists(path): | |
| 160 return path | |
| 157 else: | 161 else: |
| 158 keys = [r'HKLM\Software\Microsoft\VisualStudio\%s' % version, | 162 keys = [r'HKLM\Software\Microsoft\VisualStudio\%s' % version, |
| 159 r'HKLM\Software\Wow6432Node\Microsoft\VisualStudio\%s' % version] | 163 r'HKLM\Software\Wow6432Node\Microsoft\VisualStudio\%s' % version] |
| 160 for key in keys: | 164 for key in keys: |
| 161 path = _RegistryGetValue(key, 'InstallDir') | 165 path = _RegistryGetValue(key, 'InstallDir') |
| 162 if not path: | 166 if not path: |
| 163 continue | 167 continue |
| 164 path = os.path.normpath(os.path.join(path, '..', '..')) | 168 path = os.path.normpath(os.path.join(path, '..', '..')) |
| 165 return path | 169 return path |
| 166 | 170 |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 411 'copy_dlls': CopyDlls, | 415 'copy_dlls': CopyDlls, |
| 412 } | 416 } |
| 413 if len(sys.argv) < 2 or sys.argv[1] not in commands: | 417 if len(sys.argv) < 2 or sys.argv[1] not in commands: |
| 414 print >>sys.stderr, 'Expected one of: %s' % ', '.join(commands) | 418 print >>sys.stderr, 'Expected one of: %s' % ', '.join(commands) |
| 415 return 1 | 419 return 1 |
| 416 return commands[sys.argv[1]](*sys.argv[2:]) | 420 return commands[sys.argv[1]](*sys.argv[2:]) |
| 417 | 421 |
| 418 | 422 |
| 419 if __name__ == '__main__': | 423 if __name__ == '__main__': |
| 420 sys.exit(main()) | 424 sys.exit(main()) |
| OLD | NEW |