| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 # We need to know whether host is 64-bit so that we are looking in right | 90 # We need to know whether host is 64-bit so that we are looking in right |
| 91 # registry for Visual Studio path. | 91 # registry for Visual Studio path. |
| 92 if sys.maxsize > 2**32 or win32process.IsWow64Process(): | 92 if sys.maxsize > 2**32 or win32process.IsWow64Process(): |
| 93 wow6432Node = 'Wow6432Node\\' | 93 wow6432Node = 'Wow6432Node\\' |
| 94 else: | 94 else: |
| 95 wow6432Node = '' | 95 wow6432Node = '' |
| 96 return r'SOFTWARE\%s%s' % (wow6432Node, name) | 96 return r'SOFTWARE\%s%s' % (wow6432Node, name) |
| 97 | 97 |
| 98 # Try to guess Visual Studio location when buiding on Windows. | 98 # Try to guess Visual Studio location when buiding on Windows. |
| 99 def GuessVisualStudioPath(): | 99 def GuessVisualStudioPath(): |
| 100 defaultPath = r"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7" \ | 100 defaultPath = r"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7" \ |
| 101 r"\IDE" | 101 r"\IDE" |
| 102 defaultExecutable = "devenv.com" | 102 defaultExecutable = "devenv.com" |
| 103 | 103 |
| 104 if not IsWindows(): | 104 if not IsWindows(): |
| 105 return defaultPath, defaultExecutable | 105 return defaultPath, defaultExecutable |
| 106 | 106 |
| 107 keyNamesAndExecutables = [ | 107 keyNamesAndExecutables = [ |
| 108 # Pair for non-Express editions. | 108 # Pair for non-Express editions. |
| 109 (GetWindowsRegistryKeyName(r'Microsoft\VisualStudio'), 'devenv.com'), | 109 (GetWindowsRegistryKeyName(r'Microsoft\VisualStudio'), 'devenv.com'), |
| 110 # Pair for 2012 Express edition. | 110 # Pair for 2012 Express edition. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 135 match = re.match(r'^\d+\.\d+$', subkeyName) | 135 match = re.match(r'^\d+\.\d+$', subkeyName) |
| 136 if match: | 136 if match: |
| 137 with _winreg.OpenKey(key, subkeyName) as subkey: | 137 with _winreg.OpenKey(key, subkeyName) as subkey: |
| 138 try: | 138 try: |
| 139 (installDir, registrytype) = _winreg.QueryValueEx(subkey, | 139 (installDir, registrytype) = _winreg.QueryValueEx(subkey, |
| 140 'InstallDir') | 140 'InstallDir') |
| 141 except WindowsError: | 141 except WindowsError: |
| 142 # Can't find value under the key - continue to the next key. | 142 # Can't find value under the key - continue to the next key. |
| 143 continue | 143 continue |
| 144 isExpress = executable != 'devenv.com' | 144 isExpress = executable != 'devenv.com' |
| 145 if not isExpress and subkeyName == '10.0': | 145 if not isExpress and subkeyName == '12.0': |
| 146 # Stop search since if we found non-Express VS2010 version | 146 # Stop search since if we found non-Express VS2013 version |
| 147 # installed, which is preferred version. | 147 # installed, which is preferred version. |
| 148 return installDir, executable | 148 return installDir, executable |
| 149 else: | 149 else: |
| 150 version = float(subkeyName) | 150 version = float(subkeyName) |
| 151 # We prefer higher version of Visual Studio and given equal | 151 # We prefer higher version of Visual Studio and given equal |
| 152 # version numbers we prefer non-Express edition. | 152 # version numbers we prefer non-Express edition. |
| 153 if version > bestGuess[0]: | 153 if version > bestGuess[0]: |
| 154 bestGuess = (version, (installDir, executable)) | 154 bestGuess = (version, (installDir, executable)) |
| 155 finally: | 155 finally: |
| 156 _winreg.CloseKey(key) | 156 _winreg.CloseKey(key) |
| (...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 os.chdir(self._working_directory) | 613 os.chdir(self._working_directory) |
| 614 | 614 |
| 615 def __exit__(self, *_): | 615 def __exit__(self, *_): |
| 616 print "Enter directory = ", self._old_cwd | 616 print "Enter directory = ", self._old_cwd |
| 617 os.chdir(self._old_cwd) | 617 os.chdir(self._old_cwd) |
| 618 | 618 |
| 619 | 619 |
| 620 if __name__ == "__main__": | 620 if __name__ == "__main__": |
| 621 import sys | 621 import sys |
| 622 Main() | 622 Main() |
| OLD | NEW |