Skip to content

Commit

Permalink
windows: account for already patched liblzma.vcxproj
Browse files Browse the repository at this point in the history
3.9.13 upgraded to liblzma 5.2.5 and presumably the next 3.8 and
3.10 release will do so as well. So this rewriting is now optional.
  • Loading branch information
indygreg committed May 26, 2022
1 parent 2a7b4b0 commit 7b9e96a
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions cpython-windows/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -899,17 +899,23 @@ def hack_project_files(
# Our version of the xz sources is newer than what's in cpython-source-deps
# and the xz sources changed the path to config.h. Hack the project file
# accordingly.
liblzma_path = pcbuild_path / "liblzma.vcxproj"
static_replace_in_file(
liblzma_path,
rb"$(lzmaDir)windows;$(lzmaDir)src/liblzma/common;",
rb"$(lzmaDir)windows\vs2017;$(lzmaDir)src/liblzma/common;",
)
static_replace_in_file(
liblzma_path,
rb'<ClInclude Include="$(lzmaDir)windows\config.h" />',
rb'<ClInclude Include="$(lzmaDir)windows\vs2017\config.h" />',
)
#
# ... but CPython finally upgraded liblzma in 2022, so newer CPython releases
# already have this patch. So we're phasing it out.
try:
liblzma_path = pcbuild_path / "liblzma.vcxproj"
static_replace_in_file(
liblzma_path,
rb"$(lzmaDir)windows;$(lzmaDir)src/liblzma/common;",
rb"$(lzmaDir)windows\vs2019;$(lzmaDir)src/liblzma/common;",
)
static_replace_in_file(
liblzma_path,
rb'<ClInclude Include="$(lzmaDir)windows\config.h" />',
rb'<ClInclude Include="$(lzmaDir)windows\vs2019\config.h" />',
)
except NoSearchStringError:
pass

# Our logic for rewriting extension projects gets confused by _sqlite.vcxproj not
# having a `<PreprocessorDefinitions>` line in 3.10+. So adjust that.
Expand Down

0 comments on commit 7b9e96a

Please sign in to comment.