]> granicus.if.org Git - python/commitdiff
Issue #25143: Improves installer error messages for unsupported platforms.
authorSteve Dower <steve.dower@microsoft.com>
Sun, 11 Oct 2015 23:40:41 +0000 (16:40 -0700)
committerSteve Dower <steve.dower@microsoft.com>
Sun, 11 Oct 2015 23:40:41 +0000 (16:40 -0700)
Misc/NEWS
Tools/msi/bundle/Default.thm
Tools/msi/bundle/Default.wxl
Tools/msi/bundle/bootstrap/PythonBootstrapperApplication.cpp
Tools/msi/bundle/bootstrap/pch.h

index 9252a723f1eb7845f159cd0a993a02d53466ba89..8d69867a5318323caeee3ebf5e93a967a611d91d 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -308,6 +308,8 @@ Build
 Windows
 -------
 
+- Issue #25143: Improves installer error messages for unsupported platforms.
+
 - Issue #25163: Display correct directory in installer when using non-default
   settings.
 
index e223112f21274991299b712b87064046cc5a1212..981a0edf73e04f1cd191ca0c5e1b8cd9a7fa0582 100644 (file)
         <Image X="0" Y="0" Width="178" Height="382" ImageFile="SideBar.png"/>
 
         <Hypertext Name="FailureLogFileLink" X="205" Y="71" Width="-11" Height="60" FontId="3" TabStop="yes" HideWhenDisabled="yes">#(loc.FailureHyperlinkLogText)</Hypertext>
-        <Hypertext Name="FailureMessageText" X="205" Y="-100" Width="-11" Height="60" FontId="3" TabStop="yes" HideWhenDisabled="yes"></Hypertext>
+        <Hypertext Name="FailureMessageText" X="205" Y="151" Width="-11" Height="120" FontId="3" TabStop="yes" HideWhenDisabled="yes"></Hypertext>
         <Text Name="FailureRestartText" X="205" Y="-40" Width="-11" Height="34" FontId="3" HideWhenDisabled="yes" DisablePrefix="yes">#(loc.FailureRestartText)</Text>
         <Button Name="FailureRestartButton" X="-101" Y="-11" Width="85" Height="27" TabStop="yes" FontId="0" HideWhenDisabled="yes">#(loc.FailureRestartButton)</Button>
         <Button Name="FailureCancelButton" X="-11" Y="-11" Width="85" Height="27" TabStop="yes" FontId="0">#(loc.CloseButton)</Button>
index 7357649fe0bd173bea1a2d674cba798d9e0d2410..235f6e4a132a341c5723b9fa73c6c2362f7d14fb 100644 (file)
@@ -120,4 +120,14 @@ Feel free to email &lt;a href="mailto:python-list@python.org"&gt;python-list@pyt
   <String Id="FailureRestartText">You must restart your computer to complete the rollback of the software.</String>
   <String Id="FailureRestartButton">&amp;Restart</String>
   <String Id="FailureExistingInstall">Unable to install [WixBundleName] due to an existing install. Use Programs and Features to modify, repair or remove [WixBundleName].</String>
+  
+  <String Id="FailureWin7MissingSP1">Windows 7 Service Pack 1 and all applicable updates are required to install [WixBundleName].
+
+Please &lt;a href="https://www.bing.com/search?q=how%20to%20install%20windows%207%20service%20pack%201"&gt;update your machine&lt;/a&gt; and then restart the installation.</String>
+  <String Id="FailureVistaMissingSP2">Windows Vista Service Pack 2 and all applicable updates are required to install [WixBundleName].
+
+Please &lt;a href="https://www.bing.com/search?q=how%20to%20install%20windows%20vista%20service%20pack%202"&gt;update your machine&lt;/a&gt; and then restart the installation.</String>
+  <String Id="FailureXPOrEarlier">Windows Vista or later is required to install and use [WixBundleName].
+
+Visit &lt;a href="https://www.python.org/"&gt;python.org&lt;/a&gt; to download Python 3.4.</String>
 </WixLocalization>
index 43f30175078d98ee520871f6dbfe4f76f98534b1..71868a6ce69c9b1063d241e446bff0c555a2d4f2 100644 (file)
@@ -1216,6 +1216,8 @@ private:
         hr = pThis->CreateMainWindow();
         BalExitOnFailure(hr, "Failed to create main window.");
 
+        pThis->ValidateOperatingSystem();
+
         if (FAILED(pThis->_hrFinal)) {
             pThis->SetState(PYBA_STATE_FAILED, hr);
             ::PostMessageW(pThis->_hWnd, WM_PYBA_SHOW_FAILURE, 0, 0);
@@ -2985,6 +2987,36 @@ private:
         return hr;
     }
 
+    void ValidateOperatingSystem() {
+        LOC_STRING *pLocString = nullptr;
+        
+        if (IsWindows7SP1OrGreater()) {
+            BalLog(BOOTSTRAPPER_LOG_LEVEL_ERROR, "Target OS is Windows 7 SP1 or later");
+            return;
+        } else if (IsWindows7OrGreater()) {
+            BalLog(BOOTSTRAPPER_LOG_LEVEL_ERROR, "Detected Windows 7 RTM");
+            BalLog(BOOTSTRAPPER_LOG_LEVEL_ERROR, "Service Pack 1 is required to continue installation");
+            LocGetString(_wixLoc, L"#(loc.FailureWin7MissingSP1)", &pLocString);
+        } else if (IsWindowsVistaSP2OrGreater()) {
+            BalLog(BOOTSTRAPPER_LOG_LEVEL_ERROR, "Target OS is Windows Vista SP2");
+            return;
+        } else if (IsWindowsVistaOrGreater()) {
+            BalLog(BOOTSTRAPPER_LOG_LEVEL_ERROR, "Detected Windows Vista RTM or SP1");
+            BalLog(BOOTSTRAPPER_LOG_LEVEL_ERROR, "Service Pack 2 is required to continue installation");
+            LocGetString(_wixLoc, L"#(loc.FailureVistaMissingSP2)", &pLocString);
+        } else { 
+            BalLog(BOOTSTRAPPER_LOG_LEVEL_ERROR, "Detected Windows XP or earlier");
+            BalLog(BOOTSTRAPPER_LOG_LEVEL_ERROR, "Windows Vista SP2 or later is required to continue installation");
+            LocGetString(_wixLoc, L"#(loc.FailureXPOrEarlier)", &pLocString);
+        }
+
+        if (pLocString && pLocString->wzText) {
+            BalFormatString(pLocString->wzText, &_failedMessage);
+        }
+        
+        _hrFinal = E_WIXSTDBA_CONDITION_FAILED;
+    }
+
 public:
     //
     // Constructor - initialize member variables.
index 0956413d5c991446ec23b776238ff09d10a3d650..6a66fa5a51ebf7c26b43adbf843187584215617d 100644 (file)
@@ -23,6 +23,7 @@
 #include <stdlib.h>
 #include <strsafe.h>
 #include <stddef.h>
+#include <versionhelpers.h>
 
 #include "dutil.h"
 #include "memutil.h"