Skip to content

Commit 76b7133

Browse files
committed
Issue python#25071: Windows installer should not require TargetDir parameter when installing quietly
1 parent 0db1c42 commit 76b7133

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

Misc/NEWS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ What's New in Python 3.5.0 final?
77

88
Release date: 2015-09-13
99

10+
Build
11+
-----
12+
13+
- Issue #25071: Windows installer should not require TargetDir
14+
parameter when installing quietly
1015

1116
What's New in Python 3.5.0 release candidate 4?
1217
===============================================

Tools/msi/bundle/bootstrap/PythonBootstrapperApplication.cpp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -723,6 +723,36 @@ class PythonBootstrapperApplication : public CBalBaseBootstrapperApplication {
723723
hrStatus = EvaluateConditions();
724724
}
725725

726+
if (SUCCEEDED(hrStatus)) {
727+
// Ensure the default path has been set
728+
LONGLONG installAll;
729+
LPWSTR targetDir = nullptr;
730+
LPWSTR defaultTargetDir = nullptr;
731+
732+
hrStatus = BalGetStringVariable(L"TargetDir", &targetDir);
733+
if (FAILED(hrStatus) || !targetDir || !targetDir[0]) {
734+
ReleaseStr(targetDir);
735+
targetDir = nullptr;
736+
737+
if (FAILED(BalGetNumericVariable(L"InstallAllUsers", &installAll))) {
738+
installAll = 0;
739+
}
740+
741+
hrStatus = BalGetStringVariable(
742+
installAll ? L"DefaultAllUsersTargetDir" : L"DefaultJustForMeTargetDir",
743+
&defaultTargetDir
744+
);
745+
746+
if (SUCCEEDED(hrStatus) && defaultTargetDir) {
747+
if (defaultTargetDir[0] && SUCCEEDED(BalFormatString(defaultTargetDir, &targetDir))) {
748+
hrStatus = _engine->SetVariableString(L"TargetDir", targetDir);
749+
ReleaseStr(targetDir);
750+
}
751+
ReleaseStr(defaultTargetDir);
752+
}
753+
}
754+
}
755+
726756
SetState(PYBA_STATE_DETECTED, hrStatus);
727757

728758
// If we're not interacting with the user or we're doing a layout or we're just after a force restart

0 commit comments

Comments
 (0)