Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b966981

Browse files
committed
Issue #25143: Improves installer error messages for unsupported platforms.
1 parent 731f4a2 commit b966981

5 files changed

Lines changed: 46 additions & 1 deletion

File tree

Misc/NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,8 @@ Build
308308
Windows
309309
-------
310310

311+
- Issue #25143: Improves installer error messages for unsupported platforms.
312+
311313
- Issue #25163: Display correct directory in installer when using non-default
312314
settings.
313315

Tools/msi/bundle/Default.thm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128
<Image X="0" Y="0" Width="178" Height="382" ImageFile="SideBar.png"/>
129129

130130
<Hypertext Name="FailureLogFileLink" X="205" Y="71" Width="-11" Height="60" FontId="3" TabStop="yes" HideWhenDisabled="yes">#(loc.FailureHyperlinkLogText)</Hypertext>
131-
<Hypertext Name="FailureMessageText" X="205" Y="-100" Width="-11" Height="60" FontId="3" TabStop="yes" HideWhenDisabled="yes"></Hypertext>
131+
<Hypertext Name="FailureMessageText" X="205" Y="151" Width="-11" Height="120" FontId="3" TabStop="yes" HideWhenDisabled="yes"></Hypertext>
132132
<Text Name="FailureRestartText" X="205" Y="-40" Width="-11" Height="34" FontId="3" HideWhenDisabled="yes" DisablePrefix="yes">#(loc.FailureRestartText)</Text>
133133
<Button Name="FailureRestartButton" X="-101" Y="-11" Width="85" Height="27" TabStop="yes" FontId="0" HideWhenDisabled="yes">#(loc.FailureRestartButton)</Button>
134134
<Button Name="FailureCancelButton" X="-11" Y="-11" Width="85" Height="27" TabStop="yes" FontId="0">#(loc.CloseButton)</Button>

Tools/msi/bundle/Default.wxl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,4 +120,14 @@ Feel free to email &lt;a href="mailto:[email protected]"&gt;python-list@pyt
120120
<String Id="FailureRestartText">You must restart your computer to complete the rollback of the software.</String>
121121
<String Id="FailureRestartButton">&amp;Restart</String>
122122
<String Id="FailureExistingInstall">Unable to install [WixBundleName] due to an existing install. Use Programs and Features to modify, repair or remove [WixBundleName].</String>
123+
124+
<String Id="FailureWin7MissingSP1">Windows 7 Service Pack 1 and all applicable updates are required to install [WixBundleName].
125+
126+
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>
127+
<String Id="FailureVistaMissingSP2">Windows Vista Service Pack 2 and all applicable updates are required to install [WixBundleName].
128+
129+
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>
130+
<String Id="FailureXPOrEarlier">Windows Vista or later is required to install and use [WixBundleName].
131+
132+
Visit &lt;a href="https://www.python.org/"&gt;python.org&lt;/a&gt; to download Python 3.4.</String>
123133
</WixLocalization>

Tools/msi/bundle/bootstrap/PythonBootstrapperApplication.cpp

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1216,6 +1216,8 @@ class PythonBootstrapperApplication : public CBalBaseBootstrapperApplication {
12161216
hr = pThis->CreateMainWindow();
12171217
BalExitOnFailure(hr, "Failed to create main window.");
12181218

1219+
pThis->ValidateOperatingSystem();
1220+
12191221
if (FAILED(pThis->_hrFinal)) {
12201222
pThis->SetState(PYBA_STATE_FAILED, hr);
12211223
::PostMessageW(pThis->_hWnd, WM_PYBA_SHOW_FAILURE, 0, 0);
@@ -2985,6 +2987,36 @@ class PythonBootstrapperApplication : public CBalBaseBootstrapperApplication {
29852987
return hr;
29862988
}
29872989

2990+
void ValidateOperatingSystem() {
2991+
LOC_STRING *pLocString = nullptr;
2992+
2993+
if (IsWindows7SP1OrGreater()) {
2994+
BalLog(BOOTSTRAPPER_LOG_LEVEL_ERROR, "Target OS is Windows 7 SP1 or later");
2995+
return;
2996+
} else if (IsWindows7OrGreater()) {
2997+
BalLog(BOOTSTRAPPER_LOG_LEVEL_ERROR, "Detected Windows 7 RTM");
2998+
BalLog(BOOTSTRAPPER_LOG_LEVEL_ERROR, "Service Pack 1 is required to continue installation");
2999+
LocGetString(_wixLoc, L"#(loc.FailureWin7MissingSP1)", &pLocString);
3000+
} else if (IsWindowsVistaSP2OrGreater()) {
3001+
BalLog(BOOTSTRAPPER_LOG_LEVEL_ERROR, "Target OS is Windows Vista SP2");
3002+
return;
3003+
} else if (IsWindowsVistaOrGreater()) {
3004+
BalLog(BOOTSTRAPPER_LOG_LEVEL_ERROR, "Detected Windows Vista RTM or SP1");
3005+
BalLog(BOOTSTRAPPER_LOG_LEVEL_ERROR, "Service Pack 2 is required to continue installation");
3006+
LocGetString(_wixLoc, L"#(loc.FailureVistaMissingSP2)", &pLocString);
3007+
} else {
3008+
BalLog(BOOTSTRAPPER_LOG_LEVEL_ERROR, "Detected Windows XP or earlier");
3009+
BalLog(BOOTSTRAPPER_LOG_LEVEL_ERROR, "Windows Vista SP2 or later is required to continue installation");
3010+
LocGetString(_wixLoc, L"#(loc.FailureXPOrEarlier)", &pLocString);
3011+
}
3012+
3013+
if (pLocString && pLocString->wzText) {
3014+
BalFormatString(pLocString->wzText, &_failedMessage);
3015+
}
3016+
3017+
_hrFinal = E_WIXSTDBA_CONDITION_FAILED;
3018+
}
3019+
29883020
public:
29893021
//
29903022
// Constructor - initialize member variables.

Tools/msi/bundle/bootstrap/pch.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <stdlib.h>
2424
#include <strsafe.h>
2525
#include <stddef.h>
26+
#include <versionhelpers.h>
2627

2728
#include "dutil.h"
2829
#include "memutil.h"

0 commit comments

Comments
 (0)