From 694404bc76fae025c40894c6d727ec6b70a95f84 Mon Sep 17 00:00:00 2001
From: Isuru Fernando <isuruf@gmail.com>
Date: Fri, 28 Mar 2025 22:41:20 +0100
Subject: [PATCH 27/27] Unvendor expat

---
 PCbuild/_elementtree.vcxproj         | 22 +----------
 PCbuild/_elementtree.vcxproj.filters | 58 +---------------------------
 PCbuild/pyexpat.vcxproj              | 12 ++----
 PCbuild/pyexpat.vcxproj.filters      | 19 +--------
 4 files changed, 7 insertions(+), 104 deletions(-)

diff --git a/PCbuild/_elementtree.vcxproj b/PCbuild/_elementtree.vcxproj
index 20cc09d63ff..87927871067 100644
--- a/PCbuild/_elementtree.vcxproj
+++ b/PCbuild/_elementtree.vcxproj
@@ -93,7 +93,7 @@
   </PropertyGroup>
   <ItemDefinitionGroup>
     <ClCompile>
-      <AdditionalIncludeDirectories>..\Modules\expat;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>$(condaDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;USE_PYEXPAT_CAPI;XML_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">/d1trimfile:%SRC_DIR%</AdditionalOptions>
       <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='PGInstrument|Win32'">/d1trimfile:%SRC_DIR%</AdditionalOptions>
@@ -101,28 +101,8 @@
       <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">/d1trimfile:%SRC_DIR%</AdditionalOptions>
     </ClCompile>
   </ItemDefinitionGroup>
-  <ItemGroup>
-    <ClInclude Include="..\Modules\expat\ascii.h" />
-    <ClInclude Include="..\Modules\expat\asciitab.h" />
-    <ClInclude Include="..\Modules\expat\expat.h" />
-    <ClInclude Include="..\Modules\expat\expat_config.h" />
-    <ClInclude Include="..\Modules\expat\expat_external.h" />
-    <ClInclude Include="..\Modules\expat\iasciitab.h" />
-    <ClInclude Include="..\Modules\expat\internal.h" />
-    <ClInclude Include="..\Modules\expat\latin1tab.h" />
-    <ClInclude Include="..\Modules\expat\macconfig.h" />
-    <ClInclude Include="..\Modules\expat\nametab.h" />
-    <ClInclude Include="..\Modules\expat\pyexpatns.h" />
-    <ClInclude Include="..\Modules\expat\utf8tab.h" />
-    <ClInclude Include="..\Modules\expat\winconfig.h" />
-    <ClInclude Include="..\Modules\expat\xmlrole.h" />
-    <ClInclude Include="..\Modules\expat\xmltok.h" />
-  </ItemGroup>
   <ItemGroup>
     <ClCompile Include="..\Modules\_elementtree.c" />
-    <ClCompile Include="..\Modules\expat\xmlparse.c" />
-    <ClCompile Include="..\Modules\expat\xmlrole.c" />
-    <ClCompile Include="..\Modules\expat\xmltok.c" />
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="..\PC\python_nt.rc" />
diff --git a/PCbuild/_elementtree.vcxproj.filters b/PCbuild/_elementtree.vcxproj.filters
index bc14e31f32b..7cc8e9a3b9b 100644
--- a/PCbuild/_elementtree.vcxproj.filters
+++ b/PCbuild/_elementtree.vcxproj.filters
@@ -17,70 +17,14 @@
       <UniqueIdentifier>{f99990ba-cd06-40cc-8f28-d2d424ec13be}</UniqueIdentifier>
     </Filter>
   </ItemGroup>
-  <ItemGroup>
-    <ClInclude Include="..\Modules\expat\ascii.h">
-      <Filter>Header Files\expat</Filter>
-    </ClInclude>
-    <ClInclude Include="..\Modules\expat\asciitab.h">
-      <Filter>Header Files\expat</Filter>
-    </ClInclude>
-    <ClInclude Include="..\Modules\expat\expat.h">
-      <Filter>Header Files\expat</Filter>
-    </ClInclude>
-    <ClInclude Include="..\Modules\expat\expat_config.h">
-      <Filter>Header Files\expat</Filter>
-    </ClInclude>
-    <ClInclude Include="..\Modules\expat\expat_external.h">
-      <Filter>Header Files\expat</Filter>
-    </ClInclude>
-    <ClInclude Include="..\Modules\expat\iasciitab.h">
-      <Filter>Header Files\expat</Filter>
-    </ClInclude>
-    <ClInclude Include="..\Modules\expat\internal.h">
-      <Filter>Header Files\expat</Filter>
-    </ClInclude>
-    <ClInclude Include="..\Modules\expat\latin1tab.h">
-      <Filter>Header Files\expat</Filter>
-    </ClInclude>
-    <ClInclude Include="..\Modules\expat\macconfig.h">
-      <Filter>Header Files\expat</Filter>
-    </ClInclude>
-    <ClInclude Include="..\Modules\expat\nametab.h">
-      <Filter>Header Files\expat</Filter>
-    </ClInclude>
-    <ClInclude Include="..\Modules\expat\pyexpatns.h">
-      <Filter>Header Files\expat</Filter>
-    </ClInclude>
-    <ClInclude Include="..\Modules\expat\utf8tab.h">
-      <Filter>Header Files\expat</Filter>
-    </ClInclude>
-    <ClInclude Include="..\Modules\expat\winconfig.h">
-      <Filter>Header Files\expat</Filter>
-    </ClInclude>
-    <ClInclude Include="..\Modules\expat\xmlrole.h">
-      <Filter>Header Files\expat</Filter>
-    </ClInclude>
-    <ClInclude Include="..\Modules\expat\xmltok.h">
-      <Filter>Header Files\expat</Filter>
-    </ClInclude>
-  </ItemGroup>
   <ItemGroup>
     <ClCompile Include="..\Modules\_elementtree.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\Modules\expat\xmlparse.c">
-      <Filter>Source Files\expat</Filter>
-    </ClCompile>
-    <ClCompile Include="..\Modules\expat\xmlrole.c">
-      <Filter>Source Files\expat</Filter>
-    </ClCompile>
-    <ClCompile Include="..\Modules\expat\xmltok.c">
-      <Filter>Source Files\expat</Filter>
-    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="..\PC\python_nt.rc">
       <Filter>Resource Files</Filter>
     </ResourceCompile>
   </ItemGroup>
-</Project>
\ No newline at end of file
+</Project>
diff --git a/PCbuild/pyexpat.vcxproj b/PCbuild/pyexpat.vcxproj
index 26ac82980ca..2a9c12ebd37 100644
--- a/PCbuild/pyexpat.vcxproj
+++ b/PCbuild/pyexpat.vcxproj
@@ -90,23 +90,19 @@
   <PropertyGroup Label="UserMacros" />
   <ItemDefinitionGroup>
     <ClCompile>
-      <AdditionalIncludeDirectories>$(PySourcePath)Modules\expat;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>$(condaDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;PYEXPAT_EXPORTS;HAVE_EXPAT_H;XML_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">/d1trimfile:%SRC_DIR%</AdditionalOptions>
       <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='PGInstrument|Win32'">/d1trimfile:%SRC_DIR%</AdditionalOptions>
       <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='PGUpdate|Win32'">/d1trimfile:%SRC_DIR%</AdditionalOptions>
       <AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">/d1trimfile:%SRC_DIR%</AdditionalOptions>
     </ClCompile>
+    <Link>
+      <AdditionalDependencies>$(condaDir)\lib\expat.lib;%(AdditionalDependencies)</AdditionalDependencies>
+    </Link>
   </ItemDefinitionGroup>
-  <ItemGroup>
-    <ClInclude Include="..\Modules\expat\xmlrole.h" />
-    <ClInclude Include="..\Modules\expat\xmltok.h" />
-  </ItemGroup>
   <ItemGroup>
     <ClCompile Include="..\Modules\pyexpat.c" />
-    <ClCompile Include="..\Modules\expat\xmlparse.c" />
-    <ClCompile Include="..\Modules\expat\xmlrole.c" />
-    <ClCompile Include="..\Modules\expat\xmltok.c" />
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="..\PC\python_nt.rc" />
diff --git a/PCbuild/pyexpat.vcxproj.filters b/PCbuild/pyexpat.vcxproj.filters
index fd22fc8c477..41c73b434b9 100644
--- a/PCbuild/pyexpat.vcxproj.filters
+++ b/PCbuild/pyexpat.vcxproj.filters
@@ -11,31 +11,14 @@
       <UniqueIdentifier>{f1dbbdb5-41e5-4a88-bf8e-13da010c0ce4}</UniqueIdentifier>
     </Filter>
   </ItemGroup>
-  <ItemGroup>
-    <ClInclude Include="..\Modules\expat\xmlrole.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="..\Modules\expat\xmltok.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-  </ItemGroup>
   <ItemGroup>
     <ClCompile Include="..\Modules\pyexpat.c">
       <Filter>Source Files</Filter>
     </ClCompile>
-    <ClCompile Include="..\Modules\expat\xmlparse.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="..\Modules\expat\xmlrole.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="..\Modules\expat\xmltok.c">
-      <Filter>Source Files</Filter>
-    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="..\PC\python_nt.rc">
       <Filter>Resource Files</Filter>
     </ResourceCompile>
   </ItemGroup>
-</Project>
\ No newline at end of file
+</Project>
-- 
2.48.1

