def _getMinGWInstallDir(): """Returns the MinGW install directory. Typically: 'C:\MinGW'. @return: The path to the MinGW install directory. @rtype: string @raise WindowsError: If MinGW is not installed. """ import _winreg from cake.registry import queryString possibleSubKeys = [ r"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\MinGW", r"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{AC2C1BDB-1E91-4F94-B99C-E716FE2E9C75}_is1", ] # Try all known registry locations. for subKey in possibleSubKeys: try: return queryString(_winreg.HKEY_LOCAL_MACHINE, subKey, "InstallLocation") except WindowsError: # If this is the last possibility, re-raise the exception. if subKey is possibleSubKeys[-1]: raise
def getDefaultPlatformSdkDir(): """Returns the Microsoft Platform SDK directory. @return: The path to the Platform SDK directory. @rtype: string @raise WindowsError: If the Platform SDK is not installed. """ subKey = r"SOFTWARE\Microsoft\Microsoft SDKs\Windows" return queryString(winreg.HKEY_LOCAL_MACHINE, subKey, "CurrentInstallFolder")
def getDotNetFrameworkSdkDir(version='2.0'): """Looks up the path of the Microsoft .NET Framework SDK directory. @param version: The .NET Framework version to search for. @type version: string @return: The path to the .NET Framework SDK root directory. @rtype: string @raise WindowsError: If the .NET Framework SDK is not installed. """ subKey = r"SOFTWARE\Microsoft\.NETFramework" valueName = "sdkInstallRootv" + version return queryString(winreg.HKEY_LOCAL_MACHINE, subKey, valueName)
def getWindowsKitsDir(version='80'): """Returns the Microsoft Windows Kit directory. @param version: The version of the SDK to look-up. @type version: string @return: The path to the Windows Kit directory. @rtype: string @raise WindowsError: If this version of the Platform SDK is not installed. """ subKey = r"SOFTWARE\Microsoft\Windows Kits\Installed Roots" valueName = 'KitsRoot' if version == '80' else 'KitsRoot' + version return queryString(winreg.HKEY_LOCAL_MACHINE, subKey, valueName)
def getMsvcProductDir(version=r'VisualStudio\8.0'): """Returns the MSVC product directory as obtained from the registry. Typically: 'C:\Program Files\Microsoft Visual Studio 8\VC'. @param version: The registry path used to search for MSVS. @type version: string @return: The path to the MSVC product directory. @rtype: string @raise WindowsError: If MSVC is not installed. """ subKey = r"SOFTWARE\Microsoft\%s\Setup\VC" % version return queryString(winreg.HKEY_LOCAL_MACHINE, subKey, "ProductDir")
def getMsvsInstallDir(version=r'VisualStudio\8.0'): """Returns the MSVS install directory. Typically: 'C:\Program Files\Microsoft Visual Studio 8\Common7\IDE'. @param version: The registry path used to search for MSVS. @type version: string @return: The path to the MSVS install directory. @rtype: string @raise WindowsError: If MSVS is not installed. """ subKey = r"SOFTWARE\Microsoft\%s" % version return queryString(winreg.HKEY_LOCAL_MACHINE, subKey, "InstallDir")
def getPlatformSdkDir(version=None): """Returns the directory of the specified Microsoft Platform SDK version. @param version: The Platform SDK version to search for. @type version: string @raise WindowsError: If this version of the Platform SDK is not installed. """ if version: subKey = r"SOFTWARE\Microsoft\Microsoft SDKs\Windows\%s" % version valueName = "InstallationFolder" else: subKey = r"SOFTWARE\Microsoft\Microsoft SDKs\Windows" valueName = "CurrentInstallFolder" return queryString(winreg.HKEY_LOCAL_MACHINE, subKey, valueName)