8000 bpo-39930: Ensure vcruntime140.dll is included in all Windows package… · python/cpython@2dd4174 · GitHub
[go: up one dir, main page]

Skip to content

Commit 2dd4174

Browse files
authored
bpo-39930: Ensure vcruntime140.dll is included in all Windows packages (GH-18918)
Also adds GitHub CI test for Windows installer changes
1 parent 39c3493 commit 2dd4174

File tree

6 files changed

+67
-10
lines changed

6 files changed

+67
-10
lines changed

.github/workflows/build_msi.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: TestsMSI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- 3.8
8+
- 3.7
9+
paths:
10+
- 'Tools/msi/**'
11+
pull_request:
12+
branches:
13+
- master
14+
- 3.8
15+
- 3.7
16+
paths:
17+
- 'Tools/msi/**'
18+
19+
jobs:
20+
build_win32:
21+
name: 'Windows (x86) Installer'
22+
runs-on: windows-latest
23+
steps:
24+
- uses: actions/checkout@v1
25+
- name: Build CPython installer
26+
run: .\Tools\msi\build.bat -x86
27+
28+
build_win_amd64:
29+
name: 'Windows (x64) Installer'
30+
runs-on: windows-latest
31+
steps:
32+
- uses: actions/checkout@v1
33+
- name: Build CPython installer
34+
run: .\Tools\msi\build.bat -x64
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Ensures the required :file:`vcruntime140.dll` is included in install
2+
packages.

PCbuild/pyproject.props

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,4 +199,25 @@ public override bool Execute() {
199199
<Error Text="Unable to locate signtool.exe. Set /p:SignToolPath and rebuild" Condition="'$(_SignCommand)' == ''" />
200200
<Exec Command='$(_SignCommand) "$(TargetPath)" || $(_SignCommand) "$(TargetPath)" || $(_SignCommand) "$(TargetPath)"' ContinueOnError="false" />
201201
</Target>
202+
203+
204+
<Target Name="FindVCRuntime" Returns="VCRuntimeDLL">
205+
<PropertyGroup Condition="$(PlatformToolset) != 'v140'">
206+
<VCRedistDir>$(VCInstallDir)\Redist\MSVC\$(VCToolsRedistVersion)\</VCRedistDir>
207+
<VCRedistDir Condition="$(Platform) == 'Win32'">$(VCRedistDir)x86\</VCRedistDir>
208+
<VCRedistDir Condition="$(Platform) != 'Win32'">$(VCRedistDir)$(Platform)\</VCRedistDir>
209+
</PropertyGroup>
210+
<PropertyGroup Condition="$(PlatformToolset) == 'v140'">
211+
<VCRedistDir>$(VCInstallDir)\redist\</VCRedistDir>
212+
<VCRedistDir Condition="$(Platform) == 'Win32'">$(VCRedistDir)x86\</VCRedistDir>
213+
<VCRedistDir Condition="$(Platform) != 'Win32'">$(VCRedistDir)$(Platform)\</VCRedistDir>
214+
</PropertyGroup>
215+
216+
<ItemGroup Condition="$(VCInstallDir) != ''">
217+
<VCRuntimeDLL Include="$(VCRedistDir)\Microsoft.VC*.CRT\vcruntime*.dll" />
218+
</ItemGroup>
219+
220+
<Error Text="vcruntime14*.dll not found under $(VCInstallDir)" Condition="@(VCRuntimeDLL) == ''" />
221+
<Message Text="VCRuntimeDLL: @(VCRuntimeDLL)" Importance="high" />
222+
</Target>
202223
</Project>

PCbuild/pythoncore.vcxproj

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -527,15 +527,7 @@
527527
<Warning Text="Not including zlib is not a supported configuration." />
528528
</Target>
529529

530-
<PropertyGroup>
531-
<VCRedistDir>$(VCInstallDir)\Redist\MSVC\$(VCToolsRedistVersion)\</VCRedistDir>
532-
<VCRedistDir Condition="$(Platform) == 'Win32'">$(VCRedistDir)x86\</VCRedistDir>
533-
<VCRedistDir Condition="$(Platform) != 'Win32'">$(VCRedistDir)$(Platform)\</VCRedistDir>
534-
</PropertyGroup>
535-
<ItemGroup Condition="$(VCInstallDir) != ''">
536-
<VCRuntimeDLL Include="$(VCRedistDir)\**\vcruntime*.dll" />
537-
</ItemGroup>
538-
<Target Name="_CopyVCRuntime" AfterTargets="Build" Inputs="@(VCRuntimeDLL)" Outputs="$(OutDir)%(Filename)%(Extension)">
530+
<Target Name="_CopyVCRuntime" AfterTargets="Build" Inputs="@(VCRuntimeDLL)" Outputs="$(OutDir)%(Filename)%(Extension)" DependsOnTargets="FindVCRuntime">
539531
<!-- bpo-38597: When we switch to another VCRuntime DLL, include vcruntime140.dll as well -->
540532
<Warning Text="A copy of vcruntime140.dll is also required" Condition="!$(VCToolsRedistVersion.StartsWith(`14.`))" />
541533
<Copy SourceFiles="%(VCRuntimeDLL.FullPath)" DestinationFolder="$(OutDir)" />

Tools/msi/exe/exe.wixproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
<SuppressICEs>ICE43</SuppressICEs>
1212
</PropertyGroup>
1313
<Import Project="..\msi.props" />
14+
<PropertyGroup Condition="exists('$(BuildPath)vcruntime140_1.dll')">
15+
<DefineConstants>$(DefineConstants);Include_Vcruntime140_1_dll=1</DefineConstants>
16+
</PropertyGroup>
1417
<ItemGroup>
1518
<Compile Include="exe.wxs" />
1619
<Compile Include="exe_files.wxs" />

Tools/msi/exe/exe_files.wxs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,13 @@
3030
</RegistryKey>
3131
</Component>
3232
<Component Id="vcruntime140.dll" Directory="InstallDirectory" Guid="*">
33-
<File Name="vcruntime140.dll" Source="!(bindpath.redist)vcruntime140.dll" KeyPath="yes" />
33+
<File Name="vcruntime140.dll" Source="vcruntime140.dll" KeyPath="yes" />
3434
</Component>
35+
<?ifdef Include_Vcruntime140_1_dll ?>
36+
<Component Id="vcruntime140_1.dll" Directory="InstallDirectory" Guid="*">
37+
<File Name="vcruntime140_1.dll" Source="vcruntime140_1.dll" KeyPath="yes" />
38+
</Component>
39+
<?endif ?>
3540
</ComponentGroup>
3641
</Fragment>
3742

0 commit comments

Comments
 (0)
0