4040kits_suffix = os .path .join ("bin" , ARCH )
4141
4242WIN_SDK_KEYS = (
43+ RegKey (sdk_name = "Windows Kit 10.0" , key = kits_root ,
44+ value_name = "KitsRoot10" , suffix = os .path .join ("bin" , "10.0.16299.0" , ARCH )),
45+
46+ RegKey (sdk_name = "Windows Kit 10.0" , key = kits_root ,
47+ value_name = "KitsRoot10" , suffix = os .path .join ("bin" , "10.0.15063.0" , ARCH )),
48+
4349 RegKey (sdk_name = "Windows Kit 10.0" , key = kits_root ,
4450 value_name = "KitsRoot10" , suffix = kits_suffix ),
4551
@@ -259,7 +265,6 @@ def build_extension(self, ext):
259265 subprocess .check_call (" " .join (cmd + ["/t:Build" ]), shell = use_shell )
260266 if DEVTOOLS == "MsDev15" or DEVTOOLS == "dotnet" :
261267 subprocess .check_call (" " .join (cmd + ['"/t:Console_15:publish;Python_EmbeddingTest_15:publish"' , "/p:TargetFramework=netcoreapp2.0" ]), shell = use_shell )
262-
263268 if DEVTOOLS == "Mono" or DEVTOOLS == "dotnet" :
264269 self ._build_monoclr ()
265270
@@ -275,7 +280,13 @@ def _get_manifest(self, build_dir):
275280 return manifest
276281
277282 def _build_monoclr (self ):
278- mono_libs = _check_output ("pkg-config --libs mono-2" , shell = True )
283+ try :
284+ mono_libs = _check_output ("pkg-config --libs mono-2" , shell = True )
285+ except :
286+ if DEVTOOLS == "dotnet" :
287+ print ("Skipping building monoclr module..." )
288+ return
289+ raise
279290 mono_cflags = _check_output ("pkg-config --cflags mono-2" , shell = True )
280291 glib_libs = _check_output ("pkg-config --libs glib-2.0" , shell = True )
281292 glib_cflags = _check_output ("pkg-config --cflags glib-2.0" , shell = True )
@@ -324,6 +335,20 @@ def _install_packages(self):
324335
325336 def _find_msbuild_tool (self , tool = "msbuild.exe" , use_windows_sdk = False ):
326337 """Return full path to one of the Microsoft build tools"""
338+
339+ # trying to search path with help of vswhere when MSBuild 15.0 and higher installed.
340+ if tool == "msbuild.exe" and use_windows_sdk == False :
341+ try :
342+ basePathes = subprocess .check_output (
343+ ["tools\\ vswhere\\ vswhere.exe" , "-latest" ,
344+ "-version" , "[15.0, 16.0)" ,
345+ "-requires" , "Microsoft.Component.MSBuild" ,
346+ "-property" , "InstallationPath" ]).splitlines ()
347+ if len (basePathes ):
348+ return os .path .join (basePathes [0 ].decode (sys .stdout .encoding or "utf-8" ), "MSBuild" , "15.0" , "Bin" , "MSBuild.exe" )
349+ except :
350+ pass # keep trying to search by old method.
351+
327352 # Search in PATH first
328353 path = spawn .find_executable (tool )
329354 if path :
@@ -370,7 +395,7 @@ def _find_msbuild_tool_15(self):
370395 """Return full path to one of the Microsoft build tools"""
371396 try :
372397 basePathes = subprocess .check_output (
373- ["vswhere" , "-latest" ,
398+ ["tools \\ vswhere\\ vswhere.exe " , "-latest" ,
374399 "-version" , "[15.0, 16.0)" ,
375400 "-requires" , "Microsoft.Component.MSBuild" ,
376401 "-property" , "InstallationPath" ]).splitlines ()
0 commit comments