]> granicus.if.org Git - python/commitdiff
bpo-33614: Ensures module definition files for the stable ABI on Windows are correctl...
authorSteve Dower <steve.dower@microsoft.com>
Mon, 28 May 2018 19:32:05 +0000 (12:32 -0700)
committerGitHub <noreply@github.com>
Mon, 28 May 2018 19:32:05 +0000 (12:32 -0700)
Misc/NEWS.d/next/Build/2018-05-28-11-40-22.bpo-33614.28e0sE.rst [new file with mode: 0644]
PCbuild/find_msbuild.bat
PCbuild/python3dll.vcxproj

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 (file)
index 0000000..9091c28
--- /dev/null
@@ -0,0 +1,2 @@
+Ensures module definition files for the stable ABI on Windows are correctly
+regenerated.
index 1877906e00a55d3093be585b59175f35eaabb8b3..24f5e2fb5d46396557a87c2d5eab4905cf82c69a 100644 (file)
 @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
index c66c8ef141a14861b779cda4d3aebbe4a0e7d079..0ef7780248fbc89f87732d40f1a90ef7003d5f1a 100644 (file)
   <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>
       </_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>
       <_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