summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2018-05-28 20:16:07 (GMT)
committerGitHub <noreply@github.com>2018-05-28 20:16:07 (GMT)
commitc489a767af46f33e73d96a5746e46a7365814db2 (patch)
tree8cc3c0244956247bb3e86cc91243ee4e3fa07ce5
parent6ec325d48348fb52a421354ba563ff9c1f368054 (diff)
downloadcpython-c489a767af46f33e73d96a5746e46a7365814db2.zip
cpython-c489a767af46f33e73d96a5746e46a7365814db2.tar.gz
cpython-c489a767af46f33e73d96a5746e46a7365814db2.tar.bz2
bpo-33614: Ensures module definition files for the stable ABI on Windows are correctly regenerated. (GH-7165)
(cherry picked from commit e97ba4c690613d734843db218aeedce2f0e5937f) Co-authored-by: Steve Dower <steve.dower@microsoft.com>
-rw-r--r--Misc/NEWS.d/next/Build/2018-05-28-11-40-22.bpo-33614.28e0sE.rst2
-rw-r--r--PCbuild/find_msbuild.bat10
-rw-r--r--PCbuild/python3dll.vcxproj20
3 files changed, 27 insertions, 5 deletions
diff --git a/Misc/NEWS.d/next/Build/2018-05-28-11-40-22.bpo-33614.28e0sE.rst b/Misc/NEWS.d/next/Build/2018-05-28-11-40-22.bpo-33614.28e0sE.rst
new file mode 100644
index 0000000..9091c28
--- /dev/null
+++ b/Misc/NEWS.d/next/Build/2018-05-28-11-40-22.bpo-33614.28e0sE.rst
@@ -0,0 +1,2 @@
+Ensures module definition files for the stable ABI on Windows are correctly
+regenerated.
diff --git a/PCbuild/find_msbuild.bat b/PCbuild/find_msbuild.bat
index 2b7413f..1364a17 100644
--- a/PCbuild/find_msbuild.bat
+++ b/PCbuild/find_msbuild.bat
@@ -48,5 +48,13 @@
@exit /b 1
:found
-@echo Using %MSBUILD% (found in the %_Py_MSBuild_Source%)
+@pushd %MSBUILD% >nul 2>nul
+@if not ERRORLEVEL 1 @(
+ @if exist msbuild.exe @(set MSBUILD="%CD%\msbuild.exe") else @(set MSBUILD=)
+ @popd
+)
+
+@if defined MSBUILD @echo Using %MSBUILD% (found in the %_Py_MSBuild_Source%)
+@if not defined MSBUILD @echo Failed to find MSBuild
@set _Py_MSBuild_Source=
+@if not defined MSBUILD @exit /b 1
diff --git a/PCbuild/python3dll.vcxproj b/PCbuild/python3dll.vcxproj
index c66c8ef..0ef7780 100644
--- a/PCbuild/python3dll.vcxproj
+++ b/PCbuild/python3dll.vcxproj
@@ -89,14 +89,18 @@
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
- <Target Name="BuildPython3_dDef" BeforeTargets="BuildStubDef" Inputs="..\PC\python3.def" Outputs="$(IntDir)python3_d.def" Condition="$(Configuration) == 'Debug'">
+ <Target Name="BuildPython3_dDef" BeforeTargets="BuildStubDef" Condition="$(Configuration) == 'Debug'">
<ItemGroup>
<_DefLines Remove="@(_DefLines)" />
<_Lines Remove="@(_Lines)" />
+ <_OriginalLines Remove="@(_OriginalLines)" />
</ItemGroup>
<ReadLinesFromFile File="..\PC\python3.def">
<Output TaskParameter="Lines" ItemName="_DefLines" />
</ReadLinesFromFile>
+ <ReadLinesFromFile File="$(IntDir)python3_d.def" Condition="Exists('$(IntDir)python3_d.def')">
+ <Output TaskParameter="Lines" ItemName="_OriginalLines" />
+ </ReadLinesFromFile>
<PropertyGroup>
<_Pattern1>(=python$(MajorVersionNumber)$(MinorVersionNumber))\.</_Pattern1>
<_Sub1>$1_d.</_Sub1>
@@ -109,17 +113,23 @@
</_Lines>
</ItemGroup>
<MakeDir Directories="$(IntDir)" />
- <WriteLinesToFile File="$(IntDir)python3_d.def" Lines="@(_Lines->'%(New)')" Overwrite="true" />
+ <Message Text="Updating python3_d.def" Condition="@(_Lines->'%(New)') != @(_OriginalLines)" Importance="high" />
+ <WriteLinesToFile File="$(IntDir)python3_d.def" Lines="@(_Lines->'%(New)')" Overwrite="true"
+ Condition="@(_Lines->'%(New)') != @(_OriginalLines)" />
</Target>
- <Target Name="BuildStubDef" BeforeTargets="PreLinkEvent" Inputs="..\PC\python3.def" Outputs="$(IntDir)python3stub.def">
+ <Target Name="BuildStubDef" BeforeTargets="PreLinkEvent">
<ItemGroup>
<_DefLines Remove="@(_DefLines)" />
<_Lines Remove="@(_Lines)" />
+ <_OriginalLines Remove="@(_OriginalLines)" />
</ItemGroup>
<ReadLinesFromFile File="..\PC\python3.def">
<Output TaskParameter="Lines" ItemName="_DefLines" />
</ReadLinesFromFile>
+ <ReadLinesFromFile File="$(IntDir)python3stub.def" Condition="Exists('$(IntDir)python3stub.def')">
+ <Output TaskParameter="Lines" ItemName="_OriginalLines" />
+ </ReadLinesFromFile>
<PropertyGroup>
<_Pattern>^[\w.]+=.+?\.([^ ]+).*$</_Pattern>
<_Sub>$1</_Sub>
@@ -132,6 +142,8 @@
<_Lines Include="@(_Symbols->'%(Symbol)')" />
</ItemGroup>
<MakeDir Directories="$(IntDir)" />
- <WriteLinesToFile File="$(IntDir)python3stub.def" Lines="@(_Lines)" Overwrite="true" />
+ <Message Text="Updating python3stub.def" Condition="@(_OriginalLines) != @(_Lines)" Importance="high" />
+ <WriteLinesToFile File="$(IntDir)python3stub.def" Lines="@(_Lines)" Overwrite="true"
+ Condition="@(_DefLines) != @(_Lines)" />
</Target>
</Project> \ No newline at end of file