aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Dower <steve.dower@python.org>2020-03-11 23:24:30 +0000
committerGitHub <noreply@github.com>2020-03-11 16:24:30 -0700
commit894adc18b4fb7246b762276a50a332c0e4f0e0f0 (patch)
tree5557b444ef206216757ad78c5c5e920a338e51d8 /PCbuild/pyproject.props
parentbpo-1635741: Fix refleaks of time module error handling (GH-18486) (diff)
downloadcpython-894adc18b4fb7246b762276a50a332c0e4f0e0f0.tar.gz
cpython-894adc18b4fb7246b762276a50a332c0e4f0e0f0.tar.bz2
cpython-894adc18b4fb7246b762276a50a332c0e4f0e0f0.zip
bpo-39930: Fix MSBuild detection for Build Tools (GH-18938)
Ensure we detect Build Tools installs using the newer logic, and skip looking in the registry for VS 2017.
Diffstat (limited to 'PCbuild/pyproject.props')
-rw-r--r--PCbuild/pyproject.props34
1 files changed, 26 insertions, 8 deletions
diff --git a/PCbuild/pyproject.props b/PCbuild/pyproject.props
index 061c2253bc..bb918b28e9 100644
--- a/PCbuild/pyproject.props
+++ b/PCbuild/pyproject.props
@@ -201,23 +201,41 @@ public override bool Execute() {
</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>
+ <Target Name="FindVCRedistDir">
+ <!-- Hard coded path for VS 2015 -->
<PropertyGroup Condition="$(PlatformToolset) == 'v140'">
<VCRedistDir>$(VCInstallDir)\redist\</VCRedistDir>
+ </PropertyGroup>
+
+ <!-- Search for version number in some broken Build Tools installs -->
+ <ItemGroup Condition="$(VCRedistDir) == '' and $(VCToolsRedistVersion) == ''">
+ <_RedistFiles Include="$(VCInstallDir)\Redist\MSVC\*\*.*" />
+ </ItemGroup>
+ <PropertyGroup Condition="$(VCRedistDir) == '' and $(VCToolsRedistVersion) == ''">
+ <_RedistDir>%(_RedistFiles.Directory)</_RedistDir>
+ <VCToolsRedistVersion>$([System.IO.Path]::GetFileName($(_RedistDir.Trim(`\`))))</VCToolsRedistVersion>
+ </PropertyGroup>
+
+ <!-- Use correct path for VS 2017 and later -->
+ <PropertyGroup Condition="$(VCRedistDir) == ''">
+ <VCRedistDir>$(VCInstallDir)\Redist\MSVC\$(VCToolsRedistVersion)\</VCRedistDir>
+ </PropertyGroup>
+
+ <PropertyGroup>
<VCRedistDir Condition="$(Platform) == 'Win32'">$(VCRedistDir)x86\</VCRedistDir>
<VCRedistDir Condition="$(Platform) != 'Win32'">$(VCRedistDir)$(Platform)\</VCRedistDir>
</PropertyGroup>
+ <Message Text="VC Redist Directory: $(VCRedistDir)" />
+ <Message Text="VC Redist Version: $(VCToolsRedistVersion)" />
+ </Target>
+
+ <Target Name="FindVCRuntime" Returns="VCRuntimeDLL" DependsOnTargets="FindVCRedistDir">
<ItemGroup Condition="$(VCInstallDir) != ''">
<VCRuntimeDLL Include="$(VCRedistDir)\Microsoft.VC*.CRT\vcruntime*.dll" />
</ItemGroup>
- <Warning Text="vcruntime14*.dll not found under $(VCInstallDir)" Condition="@(VCRuntimeDLL) == ''" />
- <Message Text="VCRuntimeDLL: @(VCRuntimeDLL)" Importance="high" />
+ <Warning Text="vcruntime*.dll not found under $(VCRedistDir)." Condition="@(VCRuntimeDLL) == ''" />
+ <Message Text="VC Runtime DLL(s):%0A- @(VCRuntimeDLL,'%0A- ')" />
</Target>
</Project>