diff --git a/pythonnet/setup.py b/pythonnet/setup.py index e623ea1b4..d91951141 100644 --- a/pythonnet/setup.py +++ b/pythonnet/setup.py @@ -18,13 +18,39 @@ DEVTOOLS = "MsDev" if sys.platform == "win32" else "Mono" VERBOSITY = "minimal" # quiet, minimal, normal, detailed, diagnostic -if DEVTOOLS == "MsDev": - from distutils import msvc9compiler - msvc9compiler.VERSION = 11 +def FindMsBuildPath(): + import _winreg + + aReg = _winreg.ConnectRegistry(None,_winreg.HKEY_LOCAL_MACHINE) + try: + keysToCheck = [r"SOFTWARE\Microsoft\MSBuild\ToolsVersions\12.0", r"SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0", r"SOFTWARE\Microsoft\MSBuild\ToolsVersions\3.5", r"SOFTWARE\Microsoft\MSBuild\ToolsVersions\2.0"] + aKey = None + for key in keysToCheck: + try: + aKey = _winreg.OpenKey(aReg, key) + break + except WindowsError: + pass + + if aKey==None: + raise RuntimeError("MSBUILD.exe could not be found") + + try: + val, type = _winreg.QueryValueEx(aKey, "MSBuildToolsPath") - cc = msvc9compiler.MSVCCompiler() - cc.initialize() - _xbuild = "\"%s\"" % cc.find_exe("msbuild.exe") + if type!=_winreg.REG_SZ: + raise RuntimeError("MSBUILD.exe could not be found") + finally: + aKey.Close() + finally: + aReg.Close() + + msbuildpath = os.path.join(val, "msbuild.exe") + return msbuildpath + + +if DEVTOOLS == "MsDev": + _xbuild = "\"%s\"" % FindMsBuildPath() _defines_sep = ";" _config = "%sWin" % CONFIG _npython_exe = "nPython.exe"
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: