OLD | NEW |
---|---|
1 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 # for details. All rights reserved. Use of this source code is governed by a | 2 # for details. All rights reserved. Use of this source code is governed by a |
3 # BSD-style license that can be found in the LICENSE file. | 3 # BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 # This file contains a set of utilities functions used by other Python-based | 5 # This file contains a set of utilities functions used by other Python-based |
6 # scripts. | 6 # scripts. |
7 | 7 |
8 import commands | 8 import commands |
9 import datetime | 9 import datetime |
10 import json | 10 import json |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
96 # We need to know whether host is 64-bit so that we are looking in right | 96 # We need to know whether host is 64-bit so that we are looking in right |
97 # registry for Visual Studio path. | 97 # registry for Visual Studio path. |
98 if sys.maxsize > 2**32 or win32process.IsWow64Process(): | 98 if sys.maxsize > 2**32 or win32process.IsWow64Process(): |
99 wow6432Node = 'Wow6432Node\\' | 99 wow6432Node = 'Wow6432Node\\' |
100 else: | 100 else: |
101 wow6432Node = '' | 101 wow6432Node = '' |
102 return r'SOFTWARE\%s%s' % (wow6432Node, name) | 102 return r'SOFTWARE\%s%s' % (wow6432Node, name) |
103 | 103 |
104 # Try to guess Visual Studio location when buiding on Windows. | 104 # Try to guess Visual Studio location when buiding on Windows. |
105 def GuessVisualStudioPath(): | 105 def GuessVisualStudioPath(): |
106 defaultPath = r"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7" \ | 106 defaultPath = r"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7" \ |
107 r"\IDE" | 107 r"\IDE" |
108 defaultExecutable = "devenv.com" | 108 defaultExecutable = "devenv.com" |
109 | 109 |
110 if not IsWindows(): | 110 if not IsWindows(): |
111 return defaultPath, defaultExecutable | 111 return defaultPath, defaultExecutable |
112 | 112 |
113 keyNamesAndExecutables = [ | 113 keyNamesAndExecutables = [ |
114 # Pair for non-Express editions. | 114 # Pair for non-Express editions. |
115 (GetWindowsRegistryKeyName(r'Microsoft\VisualStudio'), 'devenv.com'), | 115 (GetWindowsRegistryKeyName(r'Microsoft\VisualStudio'), 'devenv.com'), |
116 # Pair for 2012 Express edition. | 116 # Pair for 2012 Express edition. |
(...skipping 24 matching lines...) Expand all Loading... | |
141 match = re.match(r'^\d+\.\d+$', subkeyName) | 141 match = re.match(r'^\d+\.\d+$', subkeyName) |
142 if match: | 142 if match: |
143 with _winreg.OpenKey(key, subkeyName) as subkey: | 143 with _winreg.OpenKey(key, subkeyName) as subkey: |
144 try: | 144 try: |
145 (installDir, registrytype) = _winreg.QueryValueEx(subkey, | 145 (installDir, registrytype) = _winreg.QueryValueEx(subkey, |
146 'InstallDir') | 146 'InstallDir') |
147 except WindowsError: | 147 except WindowsError: |
148 # Can't find value under the key - continue to the next key. | 148 # Can't find value under the key - continue to the next key. |
149 continue | 149 continue |
150 isExpress = executable != 'devenv.com' | 150 isExpress = executable != 'devenv.com' |
151 if not isExpress and subkeyName == '12.0': | 151 if not isExpress and subkeyName == '14.0': |
152 # Stop search since if we found non-Express VS2013 version | 152 # Stop search since if we found non-Express VS2015 version |
zra
2016/08/05 22:11:16
strike 'since'
| |
153 # installed, which is preferred version. | 153 # installed, which is preferred version. |
154 return installDir, executable | 154 return installDir, executable |
155 else: | 155 else: |
156 version = float(subkeyName) | 156 version = float(subkeyName) |
157 # We prefer higher version of Visual Studio and given equal | 157 # We prefer higher version of Visual Studio and given equal |
158 # version numbers we prefer non-Express edition. | 158 # version numbers we prefer non-Express edition. |
159 if version > bestGuess[0]: | 159 if version > bestGuess[0]: |
160 bestGuess = (version, (installDir, executable)) | 160 bestGuess = (version, (installDir, executable)) |
161 finally: | 161 finally: |
162 _winreg.CloseKey(key) | 162 _winreg.CloseKey(key) |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
653 os.chdir(self._working_directory) | 653 os.chdir(self._working_directory) |
654 | 654 |
655 def __exit__(self, *_): | 655 def __exit__(self, *_): |
656 print "Enter directory = ", self._old_cwd | 656 print "Enter directory = ", self._old_cwd |
657 os.chdir(self._old_cwd) | 657 os.chdir(self._old_cwd) |
658 | 658 |
659 | 659 |
660 if __name__ == "__main__": | 660 if __name__ == "__main__": |
661 import sys | 661 import sys |
662 Main() | 662 Main() |
OLD | NEW |