MCPcopy
hub / github.com/astral-sh/python-build-standalone / hack_props

Function hack_props

cpython-windows/build.py:379–529  ·  view source on GitHub ↗
(
    td: pathlib.Path,
    pcbuild_path: pathlib.Path,
    arch: str,
    python_version: str,
    zlib_entry: str,
)

Source from the content-addressed store, hash-verified

377
378
379def hack_props(
380 td: pathlib.Path,
381 pcbuild_path: pathlib.Path,
382 arch: str,
383 python_version: str,
384 zlib_entry: str,
385):
386 # TODO can we pass props into msbuild.exe?
387
388 # Our dependencies are in different directories from what CPython's
389 # build system expects. Modify the config file appropriately.
390
391 bzip2_version = DOWNLOADS["bzip2"]["version"]
392 sqlite_version = DOWNLOADS["sqlite"]["version"]
393 xz_version = DOWNLOADS["xz"]["version"]
394 zlib_version = DOWNLOADS[zlib_entry]["version"]
395 zstd_version = DOWNLOADS["zstd"]["version"]
396
397 mpdecimal_version = DOWNLOADS["mpdecimal"]["version"]
398
399 if meets_python_minimum_version(python_version, "3.15"):
400 tcltk_commit = DOWNLOADS["tk-windows-bin-903"]["git_commit"]
401 elif meets_python_minimum_version(python_version, "3.14") or arch == "arm64":
402 tcltk_commit = DOWNLOADS["tk-windows-bin-8614"]["git_commit"]
403 else:
404 tcltk_commit = DOWNLOADS["tk-windows-bin-8612"]["git_commit"]
405
406 sqlite_path = td / ("sqlite-autoconf-%s" % sqlite_version)
407 bzip2_path = td / ("bzip2-%s" % bzip2_version)
408 libffi_path = td / "libffi"
409 tcltk_path = td / ("cpython-bin-deps-%s" % tcltk_commit)
410 xz_path = td / ("xz-%s" % xz_version)
411 zlib_prefix = "cpython-source-deps-" if zlib_entry == "zlib-ng" else ""
412 zlib_path = td / ("%s%s-%s" % (zlib_prefix, zlib_entry, zlib_version))
413 zstd_path = td / ("cpython-source-deps-zstd-%s" % zstd_version)
414 mpdecimal_path = td / ("mpdecimal-%s" % mpdecimal_version)
415
416 openssl_root = td / "openssl" / arch
417 openssl_libs_path = openssl_root / "lib"
418 openssl_include_path = openssl_root / "include"
419
420 python_props_path = pcbuild_path / "python.props"
421 lines = []
422
423 with python_props_path.open("rb") as fh:
424 for line in fh:
425 line = line.rstrip()
426
427 # The syntax of these lines changed in 3.10+. 3.10 backport commit
428 # 3139ea33ed84190e079d6ff4859baccdad778dae. Once we drop support for
429 # Python 3.9 we can pass these via properties instead of editing the
430 # properties file.
431 if b"<bz2Dir" in line:
432 line = b"<bz2Dir>%s\\</bz2Dir>" % bzip2_path
433
434 elif b"<libffiOutDir" in line:
435 line = b"<libffiOutDir>%s\\</libffiOutDir>" % libffi_path
436

Callers 1

hack_project_filesFunction · 0.85

Calls 2

static_replace_in_fileFunction · 0.85

Tested by

no test coverage detected