@@ -899,17 +899,23 @@ def hack_project_files(
899
899
# Our version of the xz sources is newer than what's in cpython-source-deps
900
900
# and the xz sources changed the path to config.h. Hack the project file
901
901
# accordingly.
902
- liblzma_path = pcbuild_path / "liblzma.vcxproj"
903
- static_replace_in_file (
904
- liblzma_path ,
905
- rb"$(lzmaDir)windows;$(lzmaDir)src/liblzma/common;" ,
906
- rb"$(lzmaDir)windows\vs2017;$(lzmaDir)src/liblzma/common;" ,
907
- )
908
- static_replace_in_file (
909
- liblzma_path ,
910
- rb'<ClInclude Include="$(lzmaDir)windows\config.h" />' ,
911
- rb'<ClInclude Include="$(lzmaDir)windows\vs2017\config.h" />' ,
912
- )
902
+ #
903
+ # ... but CPython finally upgraded liblzma in 2022, so newer CPython releases
904
+ # already have this patch. So we're phasing it out.
905
+ try :
906
+ liblzma_path = pcbuild_path / "liblzma.vcxproj"
907
+ static_replace_in_file (
908
+ liblzma_path ,
909
+ rb"$(lzmaDir)windows;$(lzmaDir)src/liblzma/common;" ,
910
+ rb"$(lzmaDir)windows\vs2019;$(lzmaDir)src/liblzma/common;" ,
911
+ )
912
+ static_replace_in_file (
913
+ liblzma_path ,
914
+ rb'<ClInclude Include="$(lzmaDir)windows\config.h" />' ,
915
+ rb'<ClInclude Include="$(lzmaDir)windows\vs2019\config.h" />' ,
916
+ )
917
+ except NoSearchStringError :
918
+ pass
913
919
914
920
# Our logic for rewriting extension projects gets confused by _sqlite.vcxproj not
915
921
# having a `<PreprocessorDefinitions>` line in 3.10+. So adjust that.
0 commit comments