]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-43298: Improved error message when building without the Windows SDK installed...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 12 Jul 2021 15:11:33 +0000 (08:11 -0700)
committerGitHub <noreply@github.com>
Mon, 12 Jul 2021 15:11:33 +0000 (17:11 +0200)
(cherry picked from commit 80190b3e533097b55077becddc75423318ab2371)

Co-authored-by: Steve Dower <steve.dower@python.org>
Misc/NEWS.d/next/Build/2021-06-19-11-50-03.bpo-43298.9ircMb.rst [new file with mode: 0644]
PCbuild/python.props

diff --git a/Misc/NEWS.d/next/Build/2021-06-19-11-50-03.bpo-43298.9ircMb.rst b/Misc/NEWS.d/next/Build/2021-06-19-11-50-03.bpo-43298.9ircMb.rst
new file mode 100644 (file)
index 0000000..3bdc24b
--- /dev/null
@@ -0,0 +1 @@
+Improved error message when building without a Windows SDK installed.
index acbf4e005ec5bae24713d3b63c79ba9f49ac31d9..60625101b47287b6ab8e625cbb14b28d90f505cf 100644 (file)
 
     <!-- The minimum allowed SDK version to use for building -->
     <DefaultWindowsSDKVersion>10.0.10586.0</DefaultWindowsSDKVersion>
-    <DefaultWindowsSDKVersion Condition="$([System.Version]::Parse($(_RegistryVersion))) > $([System.Version]::Parse($(DefaultWindowsSDKVersion)))">$(_RegistryVersion)</DefaultWindowsSDKVersion>
+    <DefaultWindowsSDKVersion Condition="$(_RegistryVersion) != '' and $([System.Version]::Parse($(_RegistryVersion))) > $([System.Version]::Parse($(DefaultWindowsSDKVersion)))">$(_RegistryVersion)</DefaultWindowsSDKVersion>
   </PropertyGroup>
-  
+
+  <Target Name="_CheckWindowsSDKFound" BeforeTargets="_CheckWindowsSDKInstalled" Condition="$(_RegistryVersion) == ''">
+    <PropertyGroup>
+      <_Message>Failed to locate a Windows SDK installation.</_Message>
+      <_Message>$(_Message) If the build fails, please use the Visual Studio Installer to install the Windows SDK.</_Message>
+      <_Message>$(_Message) (Ignore the version number specified in the error message and select the latest.)</_Message>
+    </PropertyGroup>
+    <Warning Text="$(_Message)" />
+  </Target>
+
   <PropertyGroup Condition="$(WindowsTargetPlatformVersion) == ''">
     <WindowsTargetPlatformVersion>$(DefaultWindowsSDKVersion)</WindowsTargetPlatformVersion>
   </PropertyGroup>
     <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'b'">11</ReleaseLevelNumber>
     <ReleaseLevelNumber Condition="$(_ReleaseLevel) == 'rc'">12</ReleaseLevelNumber>
   </PropertyGroup>
-  
+
   <PropertyGroup>
     <PythonVersionNumber>$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)</PythonVersionNumber>
     <PythonVersion>$(MajorVersionNumber).$(MinorVersionNumber).$(MicroVersionNumber)$(ReleaseLevelName)</PythonVersion>