bpo-32507: Change Windows install to include app-local UCRT (#5119)

This commit is contained in:
Steve Dower 2018-01-09 19:14:46 +11:00 committed by GitHub
parent ca0c5f2656
commit d135f20ae8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 71 additions and 200 deletions

View file

@ -281,10 +281,6 @@ class PythonBootstrapperApplication : public CBalBaseBootstrapperApplication {
case ID_INSTALL_BUTTON:
SavePageSettings();
if (!WillElevate() && !QueryElevateForCrtInstall()) {
break;
}
hr = BalGetNumericVariable(L"InstallAllUsers", &installAllUsers);
ExitOnFailure(hr, L"Failed to get install scope");
@ -332,10 +328,6 @@ class PythonBootstrapperApplication : public CBalBaseBootstrapperApplication {
ReleaseStr(targetDir);
}
if (!WillElevate() && !QueryElevateForCrtInstall()) {
break;
}
OnPlan(_command.action);
break;
@ -2642,30 +2634,6 @@ private:
return result;
}
BOOL QueryElevateForCrtInstall() {
// Called to prompt the user that even though they think they won't need
// to elevate, they actually will because of the CRT install.
if (IsCrtInstalled()) {
// CRT is already installed - no need to prompt
return TRUE;
}
LONGLONG elevated;
HRESULT hr = BalGetNumericVariable(L"WixBundleElevated", &elevated);
if (SUCCEEDED(hr) && elevated) {
// Already elevated - no need to prompt
return TRUE;
}
LOC_STRING *locStr;
hr = LocGetString(_wixLoc, L"#(loc.ElevateForCRTInstall)", &locStr);
if (FAILED(hr)) {
BalLogError(hr, "Failed to get ElevateForCRTInstall string");
return FALSE;
}
return ::MessageBoxW(_hWnd, locStr->wzText, _theme->sczCaption, MB_YESNO) != IDNO;
}
HRESULT EvaluateConditions() {
HRESULT hr = S_OK;
BOOL result = FALSE;

View file

@ -71,6 +71,7 @@
<Package Include="..\tcltk\tcltk*.wixproj" />
<Package Include="..\test\test*.wixproj" />
<Package Include="..\tools\tools*.wixproj" />
<Package Include="..\ucrt\ucrt*.wixproj" />
</ItemGroup>
<PropertyGroup>

View file

@ -2,48 +2,22 @@
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<PackageGroup Id="crt">
<PackageGroupRef Id="crt_14.0_v6.0" />
<PackageGroupRef Id="crt_14.0_v6.1" />
<PackageGroupRef Id="crt_14.0_v6.2" />
<PackageGroupRef Id="crt_14.0_v6.3" />
</PackageGroup>
</Fragment>
<?foreach ver in v6.0;v6.1;v6.2;v6.3 ?>
<?if "$(var.ver)" = "v6.0" ?>
<?define msuver=6.0 ?>
<?elseif "$(var.ver)" = "v6.1" ?>
<?define msuver=6.1 ?>
<?elseif "$(var.ver)" = "v6.2" ?>
<?define msuver=8-RT ?>
<?elseif "$(var.ver)" = "v6.3" ?>
<?define msuver=8.1 ?>
<?else ?>
<?error unknown version $(var.ver) ?>
<?endif ?>
<Fragment>
<PackageGroup Id="crt_14.0_$(var.ver)">
<MsuPackage Id="crt_14.0_$(var.ver)_x86"
KB="2999226"
SourceFile="!(bindpath.redist)\Windows$(var.msuver)-KB2999226-x86.msu"
DisplayName="!(loc.CRTDescription)"
Description="!(loc.CRTDescription)"
<MsiPackage Id="ucrt_AllUsers"
SourceFile="ucrt.msi"
Compressed="$(var.CompressMSI)"
DownloadUrl="$(var.DownloadUrl)"
InstallCondition="not CRTInstalled and VersionNT = $(var.ver) and not VersionNT64 and (Include_core or Include_exe or Include_launcher or Include_pip) and not LauncherOnly" />
<MsuPackage Id="crt_14.0_$(var.ver)_x64"
KB="2999226"
SourceFile="!(bindpath.redist)\Windows$(var.msuver)-KB2999226-x64.msu"
DisplayName="!(loc.CRTDescription)"
Description="!(loc.CRTDescription)"
ForcePerMachine="yes"
InstallCondition="InstallAllUsers and not CRTInstalled and (Include_core or Include_exe or Include_pip) and not LauncherOnly">
<MsiProperty Name="TARGETDIR" Value="[TargetDir]" />
</MsiPackage>
<MsiPackage Id="ucrt_JustForMe"
SourceFile="ucrt.msi"
Compressed="$(var.CompressMSI)"
DownloadUrl="$(var.DownloadUrl)"
InstallCondition="not CRTInstalled and VersionNT64 = $(var.ver) and (Include_core or Include_exe or Include_launcher or Include_pip) and not LauncherOnly" />
ForcePerMachine="no"
InstallCondition="not InstallAllUsers and not CRTInstalled and (Include_core or Include_exe or Include_pip) and not LauncherOnly">
<MsiProperty Name="TARGETDIR" Value="[TargetDir]" />
</MsiPackage>
</PackageGroup>
</Fragment>
<?undef msuver ?>
<?endforeach ?>
</Wix>

View file

@ -3,10 +3,10 @@
<Product Id="*" Language="!(loc.LCID)" Name="!(loc.Title)" Version="$(var.Version)" Manufacturer="!(loc.Manufacturer)" UpgradeCode="$(var.UpgradeCode)">
<Package InstallerVersion="300" Compressed="yes" InstallScope="perUser" Platform="$(var.Platform)" />
<MediaTemplate EmbedCab="yes" CompressionLevel="high" />
<PropertyRef Id="UpgradeTable" />
<PropertyRef Id="REGISTRYKEY" />
<Feature Id="DefaultFeature" AllowAdvertise="no" Title="!(loc.Title)" Description="!(loc.Description)">
<ComponentGroupRef Id="exe_python" Primary="yes" />
<ComponentGroupRef Id="exe_reg" Primary="yes" />
@ -14,7 +14,7 @@
<ComponentGroupRef Id="exe_icons" />
<ComponentRef Id="OptionalFeature" />
</Feature>
<Feature Id="Shortcuts" AllowAdvertise="no" Title="!(loc.Title)" Description="!(loc.Description)">
<ComponentGroupRef Id="exe_python" />
<Component Id="exe_shortcut" Directory="MenuDir" Guid="*">

View file

@ -55,7 +55,7 @@ set binaries=%binaries% binutils
set binaries=%binaries% gpg
set binaries=%binaries% htmlhelp
set binaries=%binaries% nuget
set binaries=%binaries% redist
set binaries=%binaries% redist-1
set binaries=%binaries% wix
for %%b in (%binaries%) do (

View file

@ -54,8 +54,8 @@
<OutputPath Condition="!HasTrailingSlash($(OutputPath))">$(OutputPath)\</OutputPath>
<OutDir>$(OutputPath)</OutDir>
<ReuseCabinetCache>true</ReuseCabinetCache>
<CRTRedist Condition="'$(CRTRedist)' == ''">$(ExternalsDir)\windows-installer\redist</CRTRedist>
<CRTRedist Condition="!Exists($(CRTRedist))"></CRTRedist>
<CRTRedist Condition="'$(CRTRedist)' == ''">$(ExternalsDir)\windows-installer\redist-1\$(Platform)</CRTRedist>
<CRTRedist>$([System.IO.Path]::GetFullPath($(CRTRedist)))</CRTRedist>
<DocFilename>python$(MajorVersionNumber)$(MinorVersionNumber)$(MicroVersionNumber)$(ReleaseLevelName).chm</DocFilename>
<InstallerVersion>$(MajorVersionNumber).$(MinorVersionNumber).$(Field3Value).0</InstallerVersion>
@ -123,10 +123,7 @@
<LinkerBindInputPaths Include="$(tcltkDir)">
<BindName>tcltk</BindName>
</LinkerBindInputPaths>
<LinkerBindInputPaths Include="$(CRTRedist)" Condition="'$(CRTRedist)' != ''">
<BindName>redist</BindName>
</LinkerBindInputPaths>
<LinkerBindInputPaths Include="$(VS140COMNTOOLS)\..\..\VC\redist\$(Platform)\Microsoft.VC140.CRT">
<LinkerBindInputPaths Include="$(CRTRedist)">
<BindName>redist</BindName>
</LinkerBindInputPaths>
<LinkerBindInputPaths Include="$(BuildPath32)">

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{E233091D-2EE3-49D8-A7F1-6E266CE1B6B1}</ProjectGuid>
<SchemaVersion>2.0</SchemaVersion>
<OutputName>ucrt</OutputName>
<OutputType>Package</OutputType>
</PropertyGroup>
<Import Project="..\msi.props" />
<ItemGroup>
<Compile Include="ucrt.wxs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="*.wxl" />
</ItemGroup>
<ItemGroup>
<InstallFiles Include="$(CRTRedist)\ucrt\*.dll">
<SourceBase>$(CRTRedist)</SourceBase>
<Source>!(bindpath.redist)\</Source>
<TargetBase>$(CRTRedist)\ucrt</TargetBase>
<Target_>InstallDirectory\</Target_>
<Group>ucrt_dll</Group>
<IncludeInCat>false</IncludeInCat>
</InstallFiles>
</ItemGroup>
<Import Project="..\msi.targets" />
</Project>

14
Tools/msi/ucrt/ucrt.wxs Normal file
View file

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Language="!(loc.LCID)" Name="!(loc.Title)" Version="$(var.Version)" Manufacturer="!(loc.Manufacturer)" UpgradeCode="$(var.UpgradeCode)">
<Package InstallerVersion="300" Compressed="yes" InstallScope="perUser" Platform="$(var.Platform)" />
<MediaTemplate EmbedCab="yes" CompressionLevel="high" />
<PropertyRef Id="UpgradeTable" />
<PropertyRef Id="REGISTRYKEY" />
<Feature Id="DefaultFeature" AllowAdvertise="no" Title="!(loc.Title)" Description="!(loc.Description)">
<ComponentGroupRef Id="ucrt_dll" />
</Feature>
</Product>
</Wix>

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<WixLocalization Culture="en-us" xmlns="http://schemas.microsoft.com/wix/2006/localization">
<String Id="Descriptor">C Runtime Library</String>
<String Id="ShortDescriptor">ucrt</String>
</WixLocalization>

View file

@ -21,7 +21,7 @@
</PropertyGroup>
<ItemGroup>
<File Include="$(OutputPath)\*.msi;$(OutputPath)\*.msu">
<File Include="$(OutputPath)\*.msi">
<CopyTo>$(MSITarget)</CopyTo>
</File>
<File Include="$(OutputPath)\*.exe;$(OutputPath)\*.zip">