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

@ -0,0 +1,2 @@
Use app-local UCRT install rather than the proper update for old versions of
Windows.

View file

@ -0,0 +1 @@
Ensure separate Modify and Uninstall buttons are displayed.

View file

@ -1,77 +0,0 @@
In Win32, DLL's are "pre-linked" using a specified base address.
When the DLL is loaded, an attempt is made to place it at
that address. If that address is already in use, a new base address
is selected, and the DLL subject to fixups. Apparently, these
fixups are very slow, and significant performance gains can be
made by selecting a good base address.
This document is to allocate base addresses to core Python
and Python .PYD files, to give a better change of optimal performance.
This base address is passed to the linker using the /BASE
command line switch.
Python.exe/Pythonw.exe - 1d000000 - 1e000000 (-1)
Python.dll - 1e000000 - 1e100000 (-1)
Standard Extension Modules 1e100000 - 1e200000 ""
- _symtable 1e100000 - 1e110000 pyd removed in 2.4
- bsddb 1e180000 - 1e188000 pyd removed in 3.0
- _tkinter 1e190000 - 1e1A0000
- parser 1e1A0000 - 1e1B0000 pyd removed in 2.4
- zlib 1e1B0000 - 1e1C0000
- winreg 1e1C0000 - 1e1D0000 pyd removed in 2.4
- _socket 1e1D0000 - 1e1E0000
- _sre 1e1E0000 - 1e1F0000 pyd removed in 2.4
- mmap 1e1F0000 - 1e1FFFFF pyd removed in 2.4
More standard extensions 1D100000 - 1e000000
- pyexpat 1D100000 - 1D110000
- select 1D110000 - 1D120000
- unicodedata 1D120000 - 1D160000
- winsound 1D160000 - 1D170000
- bZ2 1D170000 - 1D180000
- datetime 1D180000 - 1D190000 pyd removed in 2.4
- _csv 1D190000 - 1D1A0000 pyd removed in 2.4
- _ctypes 1D1A0000 - 1D1B0000
Other extension modules
- win32api 1e200000 - 1e220000
- win32ras 1e220000 - 1e230000
- win32lz 1e230000 - 1e240000
- timer 1e240000 - 1e250000
- mmapfile 1e250000 - 1e260000
- win32pipe 1e260000 - 1e270000
- avl 1e270000 - 1e270000
- dbhash 1e280000 - 1e290000
- win32net 1e290000 - 1e2A0000
- win32security 1e2A0000 - 1e2B0000
- win32print 1e2B0000 - 1e2c0000
- <unused> 1e2d0000 - 1e2e0000
- win32gui 1e2e0000 - 1e2f0000
- _imaging 1e2f0000 - 1e300000
- multiarray 1e300000 - 1e310000
- win32help 1e310000 - 1e320000
- win32clipboard 1e320000 - 1e330000
- win2kras 1e330000 - 1e340000
- pythoncom 1e340000 - 1e400000
- win32ui 1e400000 - 1e500000
- win32uiole 1e500000 - 1e600000
- pywintypes 1e600000 - 1e700000
- win32process 1e700000 - 1e800000
- odbc 1e710000 - 1e720000
- dbi 1e720000 - 1e730000
- win32file 1e730000 - 1e740000
- win32wnet 1e740000 - 1e750000
- win32com.shell 1e750000 - 1e760000
- win32com.internet 1e760000 - 1e770000
- win32com.exchange 1e770000 - 1e780000
- win32com.exchdapi 1e780000 - 1e790000
- win32com.axscript 1e790000 - 1e7a0000
- win32com.axdebug 1e7b0000 - 1e7c0000
- win32com.adsi 1e7f0000 - 1e800000
- win32event 1e810000 - 1e820000
- win32evtlog 1e820000 - 1e830000
- win32com.axcontrol 1e830000 - 1e840000

View file

@ -66,9 +66,6 @@
<PreprocessorDefinitions>WIN32;_FILE_OFFSET_BITS=64;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<DisableSpecificWarnings>4244;4267;%(DisableSpecificWarnings)</DisableSpecificWarnings>
</ClCompile>
<Link>
<BaseAddress>0x1D170000</BaseAddress>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\Modules\_bz2module.c" />

View file

@ -64,7 +64,6 @@
<AdditionalIncludeDirectories>..\Modules\_ctypes\libffi_msvc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<BaseAddress>0x1D1A0000</BaseAddress>
<AdditionalOptions>/EXPORT:DllGetClassObject,PRIVATE /EXPORT:DllCanUnloadNow,PRIVATE %(AdditionalOptions)</AdditionalOptions>
</Link>
</ItemDefinitionGroup>

View file

@ -66,9 +66,6 @@
<PreprocessorDefinitions Condition="'$(Platform)' == 'x64'">CONFIG_64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..\Modules\_decimal;..\Modules\_decimal\libmpdec;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<BaseAddress>0x1D1A0000</BaseAddress>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="..\Modules\_decimal\libmpdec\basearith.h" />

View file

@ -64,9 +64,6 @@
<AdditionalIncludeDirectories>..\Modules\expat;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;USE_PYEXPAT_CAPI;XML_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<BaseAddress>0x1D100000</BaseAddress>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="..\Modules\expat\ascii.h" />

View file

@ -62,7 +62,6 @@
<ItemDefinitionGroup>
<Link>
<AdditionalDependencies>cabinet.lib;msi.lib;rpcrt4.lib;%(AdditionalDependencies)</AdditionalDependencies>
<BaseAddress>0x1D160000</BaseAddress>
</Link>
</ItemDefinitionGroup>
<ItemGroup>

View file

@ -62,7 +62,6 @@
<ItemDefinitionGroup>
<Link>
<AdditionalDependencies>ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<BaseAddress>0x1e1D0000</BaseAddress>
</Link>
</ItemDefinitionGroup>
<ItemGroup>

View file

@ -62,7 +62,6 @@
<ItemDefinitionGroup>
<Link>
<AdditionalDependencies>ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<BaseAddress>0x1D110000</BaseAddress>
</Link>
</ItemDefinitionGroup>
<ItemGroup>

View file

@ -62,7 +62,6 @@
<ItemDefinitionGroup>
<Link>
<AdditionalDependencies>ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<BaseAddress>0x1e1D0000</BaseAddress>
</Link>
</ItemDefinitionGroup>
<ItemGroup>

View file

@ -64,9 +64,6 @@
<AdditionalIncludeDirectories>$(sqlite3Dir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>MODULE_NAME="sqlite3";%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<BaseAddress>0x1e180000</BaseAddress>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="..\Modules\_sqlite\cache.h" />

View file

@ -60,11 +60,6 @@
<PropertyGroup>
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
</PropertyGroup>
<ItemDefinitionGroup>
<Link>
<BaseAddress>0x1e1F0000</BaseAddress>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\Modules\_testbuffer.c" />
</ItemGroup>

View file

@ -60,11 +60,6 @@
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
</PropertyGroup>
<ItemDefinitionGroup>
<Link>
<BaseAddress>0x1e1F0000</BaseAddress>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\Modules\_testcapimodule.c" />
</ItemGroup>

View file

@ -60,11 +60,6 @@
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
</PropertyGroup>
<ItemDefinitionGroup>
<Link>
<BaseAddress>0x1e1F0000</BaseAddress>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\Modules\_testimportmultiple.c" />
</ItemGroup>

View file

@ -62,7 +62,6 @@
<Link>
<SubSystem>Console</SubSystem>
<StackReserveSize>2000000</StackReserveSize>
<BaseAddress>0x1d000000</BaseAddress>
</Link>
</ItemDefinitionGroup>
<ItemGroup>

View file

@ -76,7 +76,6 @@
<Link>
<AdditionalDependencies>version.lib;shlwapi.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories);$(PySourcePath)PC\external\$(PlatformToolset)\$(ArchName)</AdditionalLibraryDirectories>
<BaseAddress>0x1e000000</BaseAddress>
</Link>
</ItemDefinitionGroup>
<ItemGroup>

View file

@ -58,7 +58,6 @@
<ItemDefinitionGroup>
<Link>
<StackReserveSize>2000000</StackReserveSize>
<BaseAddress>0x1d000000</BaseAddress>
</Link>
</ItemDefinitionGroup>
<ItemGroup>

View file

@ -61,7 +61,6 @@
<ItemDefinitionGroup>
<Link>
<AdditionalDependencies>ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<BaseAddress>0x1D110000</BaseAddress>
</Link>
</ItemDefinitionGroup>
<ItemGroup>

View file

@ -59,11 +59,6 @@
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
</PropertyGroup>
<ItemDefinitionGroup>
<Link>
<BaseAddress>0x1D120000</BaseAddress>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="..\Modules\unicodedata_db.h" />
<ClInclude Include="..\Modules\unicodename_db.h" />

View file

@ -66,7 +66,6 @@
</ClCompile>
<Link>
<AdditionalDependencies>wsock32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<BaseAddress>0x1D110000</BaseAddress>
</Link>
</ItemDefinitionGroup>
<ItemGroup>

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">