Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Ensure command-line and unattend.xml setting override previously detected
states in Windows installer.
30 changes: 24 additions & 6 deletions Tools/msi/bundle/bootstrap/PythonBootstrapperApplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -727,9 +727,13 @@ class PythonBootstrapperApplication : public CBalBaseBootstrapperApplication {
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"InstallLauncherAllUsers", fPerMachine ? 1 : 0);
}
return CheckCanceled() ? IDCANCEL : IDNOACTION;
}
Expand Down Expand Up @@ -796,6 +800,12 @@ class PythonBootstrapperApplication : public CBalBaseBootstrapperApplication {
}
}

LONGLONG includeLauncher;
if (SUCCEEDED(BalGetNumericVariable(L"Include_launcher", &includeLauncher))
&& includeLauncher != -1) {
detectedLauncher = FALSE;
}

if (detectedLauncher) {
/* When we detect the current version of the launcher. */
_engine->SetVariableNumeric(L"Include_launcher", 1);
Expand All @@ -819,6 +829,14 @@ class PythonBootstrapperApplication : public CBalBaseBootstrapperApplication {
_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)) {
hrStatus = EvaluateConditions();
}
Expand Down Expand Up @@ -1451,6 +1469,10 @@ class PythonBootstrapperApplication : public CBalBaseBootstrapperApplication {
hr = ParseOverridableVariablesFromXml(pixdManifest);
BalExitOnFailure(hr, "Failed to read overridable variables.");

if (_command.action == BOOTSTRAPPER_ACTION_MODIFY) {
LoadOptionalFeatureStates(_engine);
}

hr = ParseVariablesFromUnattendXml();
ExitOnFailure(hr, "Failed to read unattend.ini file.");

Expand Down Expand Up @@ -1478,10 +1500,6 @@ class PythonBootstrapperApplication : public CBalBaseBootstrapperApplication {
hr = UpdateUIStrings(_command.action);
BalExitOnFailure(hr, "Failed to load UI strings.");

if (_command.action == BOOTSTRAPPER_ACTION_MODIFY) {
LoadOptionalFeatureStates(_engine);
}

GetBundleFileVersion();
// don't fail if we couldn't get the version info; best-effort only
LExit:
Expand Down
3 changes: 1 addition & 2 deletions Tools/msi/bundle/bundle.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,10 @@
<Variable Name="Include_tools" 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_launcher" Value="-1" bal:Overridable="yes" />
<?if "$(var.PyTestExt)"="" ?>
<Variable Name="Include_launcher" Value="1" bal:Overridable="yes" />
<Variable Name="Include_launcherState" Value="enabled" bal:Overridable="yes" />
<?else ?>
<Variable Name="Include_launcher" Value="0" />
<Variable Name="Include_launcherState" Value="disable" />
<?endif ?>
<Variable Name="Include_symbols" Value="0" bal:Overridable="yes" />
Expand Down