bpo-37283: Ensure command-line and unattend.xml setting override previously detected states in Windows installer (GH-15759)

(cherry picked from commit 3a0ddbcdfc)

Co-authored-by: Steve Dower <steve.dower@python.org>
This commit is contained in:
Miss Islington (bot) 2019-09-09 06:02:42 -07:00 committed by GitHub
parent 12acb5b9c8
commit 2a4a982cbc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 8 deletions

View file

@ -0,0 +1,2 @@
Ensure command-line and unattend.xml setting override previously detected
states in Windows installer.

View file

@ -727,9 +727,13 @@ public: // IBootstrapperApplication
BalLog(BOOTSTRAPPER_LOG_LEVEL_ERROR, "Failed to load AssociateFiles state: error code 0x%08X", hr); BalLog(BOOTSTRAPPER_LOG_LEVEL_ERROR, "Failed to load AssociateFiles state: error code 0x%08X", hr);
} }
_engine->SetVariableNumeric(L"Include_launcher", 1); LONGLONG includeLauncher;
if (FAILED(BalGetNumericVariable(L"Include_launcher", &includeLauncher))
|| includeLauncher == -1) {
_engine->SetVariableNumeric(L"Include_launcher", 1);
_engine->SetVariableNumeric(L"InstallLauncherAllUsers", fPerMachine ? 1 : 0);
}
_engine->SetVariableNumeric(L"DetectedOldLauncher", 1); _engine->SetVariableNumeric(L"DetectedOldLauncher", 1);
_engine->SetVariableNumeric(L"InstallLauncherAllUsers", fPerMachine ? 1 : 0);
} }
return CheckCanceled() ? IDCANCEL : IDNOACTION; return CheckCanceled() ? IDCANCEL : IDNOACTION;
} }
@ -796,6 +800,12 @@ public: // IBootstrapperApplication
} }
} }
LONGLONG includeLauncher;
if (SUCCEEDED(BalGetNumericVariable(L"Include_launcher", &includeLauncher))
&& includeLauncher != -1) {
detectedLauncher = FALSE;
}
if (detectedLauncher) { if (detectedLauncher) {
/* When we detect the current version of the launcher. */ /* When we detect the current version of the launcher. */
_engine->SetVariableNumeric(L"Include_launcher", 1); _engine->SetVariableNumeric(L"Include_launcher", 1);
@ -819,6 +829,14 @@ public: // IBootstrapperApplication
_baFunction->OnDetectComplete(); _baFunction->OnDetectComplete();
} }
if (SUCCEEDED(hrStatus)) {
LONGLONG includeLauncher;
if (SUCCEEDED(BalGetNumericVariable(L"Include_launcher", &includeLauncher))
&& includeLauncher == -1) {
_engine->SetVariableNumeric(L"Include_launcher", 1);
}
}
if (SUCCEEDED(hrStatus)) { if (SUCCEEDED(hrStatus)) {
hrStatus = EvaluateConditions(); hrStatus = EvaluateConditions();
} }
@ -1451,6 +1469,10 @@ private:
hr = ParseOverridableVariablesFromXml(pixdManifest); hr = ParseOverridableVariablesFromXml(pixdManifest);
BalExitOnFailure(hr, "Failed to read overridable variables."); BalExitOnFailure(hr, "Failed to read overridable variables.");
if (_command.action == BOOTSTRAPPER_ACTION_MODIFY) {
LoadOptionalFeatureStates(_engine);
}
hr = ParseVariablesFromUnattendXml(); hr = ParseVariablesFromUnattendXml();
ExitOnFailure(hr, "Failed to read unattend.ini file."); ExitOnFailure(hr, "Failed to read unattend.ini file.");
@ -1478,10 +1500,6 @@ private:
hr = UpdateUIStrings(_command.action); hr = UpdateUIStrings(_command.action);
BalExitOnFailure(hr, "Failed to load UI strings."); BalExitOnFailure(hr, "Failed to load UI strings.");
if (_command.action == BOOTSTRAPPER_ACTION_MODIFY) {
LoadOptionalFeatureStates(_engine);
}
GetBundleFileVersion(); GetBundleFileVersion();
// don't fail if we couldn't get the version info; best-effort only // don't fail if we couldn't get the version info; best-effort only
LExit: LExit:

View file

@ -71,11 +71,10 @@
<Variable Name="Include_tools" Value="1" bal:Overridable="yes" /> <Variable Name="Include_tools" Value="1" bal:Overridable="yes" />
<Variable Name="Include_tcltk" Value="1" bal:Overridable="yes" /> <Variable Name="Include_tcltk" Value="1" bal:Overridable="yes" />
<Variable Name="Include_pip" Value="1" bal:Overridable="yes" /> <Variable Name="Include_pip" Value="1" bal:Overridable="yes" />
<Variable Name="Include_launcher" Value="-1" bal:Overridable="yes" />
<?if "$(var.PyTestExt)"="" ?> <?if "$(var.PyTestExt)"="" ?>
<Variable Name="Include_launcher" Value="1" bal:Overridable="yes" />
<Variable Name="Include_launcherState" Value="enabled" bal:Overridable="yes" /> <Variable Name="Include_launcherState" Value="enabled" bal:Overridable="yes" />
<?else ?> <?else ?>
<Variable Name="Include_launcher" Value="0" />
<Variable Name="Include_launcherState" Value="disable" /> <Variable Name="Include_launcherState" Value="disable" />
<?endif ?> <?endif ?>
<Variable Name="Include_symbols" Value="0" bal:Overridable="yes" /> <Variable Name="Include_symbols" Value="0" bal:Overridable="yes" />