Skip to content

[3.8] bpo-39930: Ensure vcruntime140.dll is included in all Windows packages (GH-18918) #18919

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 11, 2020
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
34 changes: 34 additions & 0 deletions .github/workflows/build_msi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: TestsMSI

on:
push:
branches:
- master
- 3.8
- 3.7
paths:
- 'Tools/msi/**'
pull_request:
branches:
- master
- 3.8
- 3.7
paths:
- 'Tools/msi/**'

jobs:
build_win32:
name: 'Windows (x86) Installer'
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
- name: Build CPython installer
run: .\Tools\msi\build.bat -x86

build_win_amd64:
name: 'Windows (x64) Installer'
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
- name: Build CPython installer
run: .\Tools\msi\build.bat -x64
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Ensures the required :file:`vcruntime140.dll` is included in install
packages.
21 changes: 21 additions & 0 deletions PCbuild/pyproject.props
Original file line number Diff line number Diff line change
Expand Up @@ -200,4 +200,25 @@ public override bool Execute() {
<Error Text="Unable to locate signtool.exe. Set /p:SignToolPath and rebuild" Condition="'$(_SignCommand)' == ''" />
<Exec Command='$(_SignCommand) "$(TargetPath)" || $(_SignCommand) "$(TargetPath)" || $(_SignCommand) "$(TargetPath)"' ContinueOnError="false" />
</Target>


<Target Name="FindVCRuntime" Returns="VCRuntimeDLL">
<PropertyGroup Condition="$(PlatformToolset) != 'v140'">
<VCRedistDir>$(VCInstallDir)\Redist\MSVC\$(VCToolsRedistVersion)\</VCRedistDir>
<VCRedistDir Condition="$(Platform) == 'Win32'">$(VCRedistDir)x86\</VCRedistDir>
<VCRedistDir Condition="$(Platform) != 'Win32'">$(VCRedistDir)$(Platform)\</VCRedistDir>
</PropertyGroup>
<PropertyGroup Condition="$(PlatformToolset) == 'v140'">
<VCRedistDir>$(VCInstallDir)\redist\</VCRedistDir>
<VCRedistDir Condition="$(Platform) == 'Win32'">$(VCRedistDir)x86\</VCRedistDir>
<VCRedistDir Condition="$(Platform) != 'Win32'">$(VCRedistDir)$(Platform)\</VCRedistDir>
</PropertyGroup>

<ItemGroup Condition="$(VCInstallDir) != ''">
<VCRuntimeDLL Include="$(VCRedistDir)\Microsoft.VC*.CRT\vcruntime*.dll" />
</ItemGroup>

<Error Text="vcruntime14*.dll not found under $(VCInstallDir)" Condition="@(VCRuntimeDLL) == ''" />
<Message Text="VCRuntimeDLL: @(VCRuntimeDLL)" Importance="high" />
</Target>
</Project>
10 changes: 1 addition & 9 deletions PCbuild/pythoncore.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -519,15 +519,7 @@
<Warning Text="Not including zlib is not a supported configuration." />
</Target>

<PropertyGroup>
<VCRedistDir>$(VCInstallDir)\Redist\MSVC\$(VCToolsRedistVersion)\</VCRedistDir>
<VCRedistDir Condition="$(Platform) == 'Win32'">$(VCRedistDir)x86\</VCRedistDir>
<VCRedistDir Condition="$(Platform) != 'Win32'">$(VCRedistDir)$(Platform)\</VCRedistDir>
</PropertyGroup>
<ItemGroup Condition="$(VCInstallDir) != ''">
<VCRuntimeDLL Include="$(VCRedistDir)\**\vcruntime*.dll" />
</ItemGroup>
<Target Name="_CopyVCRuntime" AfterTargets="Build" Inputs="@(VCRuntimeDLL)" Outputs="$(OutDir)%(Filename)%(Extension)">
<Target Name="_CopyVCRuntime" AfterTargets="Build" Inputs="@(VCRuntimeDLL)" Outputs="$(OutDir)%(Filename)%(Extension)" DependsOnTargets="FindVCRuntime">
<!-- bpo-38597: When we switch to another VCRuntime DLL, include vcruntime140.dll as well -->
<Warning Text="A copy of vcruntime140.dll is also required" Condition="!$(VCToolsRedistVersion.StartsWith(`14.`))" />
<Copy SourceFiles="%(VCRuntimeDLL.FullPath)" DestinationFolder="$(OutDir)" />
Expand Down
3 changes: 3 additions & 0 deletions Tools/msi/exe/exe.wixproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
<SuppressICEs>ICE43</SuppressICEs>
</PropertyGroup>
<Import Project="..\msi.props" />
<PropertyGroup Condition="exists('$(BuildPath)vcruntime140_1.dll')">
<DefineConstants>$(DefineConstants);Include_Vcruntime140_1_dll=1</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Compile Include="exe.wxs" />
<Compile Include="exe_files.wxs" />
Expand Down
7 changes: 6 additions & 1 deletion Tools/msi/exe/exe_files.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,13 @@
</RegistryKey>
</Component>
<Component Id="vcruntime140.dll" Directory="InstallDirectory" Guid="*">
<File Name="vcruntime140.dll" Source="!(bindpath.redist)vcruntime140.dll" KeyPath="yes" />
<File Name="vcruntime140.dll" Source="vcruntime140.dll" KeyPath="yes" />
</Component>
<?ifdef Include_Vcruntime140_1_dll ?>
<Component Id="vcruntime140_1.dll" Directory="InstallDirectory" Guid="*">
<File Name="vcruntime140_1.dll" Source="vcruntime140_1.dll" KeyPath="yes" />
</Component>
<?endif ?>
</ComponentGroup>
</Fragment>

Expand Down