OLD | NEW |
1 # Copyright (c) 2013 Google Inc. All rights reserved. | 1 # Copyright (c) 2013 Google Inc. 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 """Handle version information related to Visual Stuio.""" | 5 """Handle version information related to Visual Stuio.""" |
6 | 6 |
7 import errno | 7 import errno |
8 import os | 8 import os |
9 import re | 9 import re |
10 import subprocess | 10 import subprocess |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 # Obtain the stdout from reg.exe, reading to the end so p.returncode is valid | 131 # Obtain the stdout from reg.exe, reading to the end so p.returncode is valid |
132 # Note that the error text may be in [1] in some cases | 132 # Note that the error text may be in [1] in some cases |
133 text = p.communicate()[0] | 133 text = p.communicate()[0] |
134 # Check return code from reg.exe; officially 0==success and 1==error | 134 # Check return code from reg.exe; officially 0==success and 1==error |
135 if p.returncode: | 135 if p.returncode: |
136 return None | 136 return None |
137 return text | 137 return text |
138 | 138 |
139 | 139 |
140 def _RegistryQuery(key, value=None): | 140 def _RegistryQuery(key, value=None): |
141 """Use reg.exe to read a particular key through _RegistryQueryBase. | 141 r"""Use reg.exe to read a particular key through _RegistryQueryBase. |
142 | 142 |
143 First tries to launch from %WinDir%\Sysnative to avoid WoW64 redirection. If | 143 First tries to launch from %WinDir%\Sysnative to avoid WoW64 redirection. If |
144 that fails, it falls back to System32. Sysnative is available on Vista and | 144 that fails, it falls back to System32. Sysnative is available on Vista and |
145 up and available on Windows Server 2003 and XP through KB patch 942589. Note | 145 up and available on Windows Server 2003 and XP through KB patch 942589. Note |
146 that Sysnative will always fail if using 64-bit python due to it being a | 146 that Sysnative will always fail if using 64-bit python due to it being a |
147 virtual directory and System32 will work correctly in the first place. | 147 virtual directory and System32 will work correctly in the first place. |
148 | 148 |
149 KB 942589 - http://support.microsoft.com/kb/942589/en-us. | 149 KB 942589 - http://support.microsoft.com/kb/942589/en-us. |
150 | 150 |
151 Arguments: | 151 Arguments: |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 versions = _DetectVisualStudioVersions(version_map[version], 'e' in version) | 420 versions = _DetectVisualStudioVersions(version_map[version], 'e' in version) |
421 if not versions: | 421 if not versions: |
422 if not allow_fallback: | 422 if not allow_fallback: |
423 raise ValueError('Could not locate Visual Studio installation.') | 423 raise ValueError('Could not locate Visual Studio installation.') |
424 if version == 'auto': | 424 if version == 'auto': |
425 # Default to 2005 if we couldn't find anything | 425 # Default to 2005 if we couldn't find anything |
426 return _CreateVersion('2005', None) | 426 return _CreateVersion('2005', None) |
427 else: | 427 else: |
428 return _CreateVersion(version, None) | 428 return _CreateVersion(version, None) |
429 return versions[0] | 429 return versions[0] |
OLD | NEW |