Obtain build metadata for the Python distribution.
(
build_env,
version,
platform,
target_triple,
musl,
lto,
static,
extensions,
extra_metadata,
)
| 464 | |
| 465 | |
| 466 | def python_build_info( |
| 467 | build_env, |
| 468 | version, |
| 469 | platform, |
| 470 | target_triple, |
| 471 | musl, |
| 472 | lto, |
| 473 | static, |
| 474 | extensions, |
| 475 | extra_metadata, |
| 476 | ): |
| 477 | """Obtain build metadata for the Python distribution.""" |
| 478 | |
| 479 | log("resolving Python distribution build info") |
| 480 | |
| 481 | bi = {"core": {"objs": [], "links": []}, "extensions": {}} |
| 482 | |
| 483 | binary_suffix = "" |
| 484 | |
| 485 | if platform in ("linux_x86_64", "linux_aarch64"): |
| 486 | arch = platform.removeprefix("linux_") |
| 487 | |
| 488 | bi["core"]["static_lib"] = ( |
| 489 | f"install/lib/python{version}/config-{version}{binary_suffix}-{arch}-linux-gnu/libpython{version}{binary_suffix}.a" |
| 490 | ) |
| 491 | |
| 492 | if not static: |
| 493 | bi["core"]["shared_lib"] = "install/lib/libpython%s%s.so.1.0" % ( |
| 494 | version, |
| 495 | binary_suffix, |
| 496 | ) |
| 497 | |
| 498 | if lto: |
| 499 | llvm_version = DOWNLOADS[clang_toolchain(platform, target_triple)][ |
| 500 | "version" |
| 501 | ] |
| 502 | if "+" in llvm_version: |
| 503 | llvm_version = llvm_version.split("+")[0] |
| 504 | |
| 505 | object_file_format = f"llvm-bitcode:%{llvm_version}" |
| 506 | else: |
| 507 | object_file_format = "elf" |
| 508 | elif platform.startswith("macos_"): |
| 509 | bi["core"]["static_lib"] = ( |
| 510 | f"install/lib/python{version}/config-{version}{binary_suffix}-darwin/libpython{version}{binary_suffix}.a" |
| 511 | ) |
| 512 | bi["core"]["shared_lib"] = "install/lib/libpython%s%s.dylib" % ( |
| 513 | version, |
| 514 | binary_suffix, |
| 515 | ) |
| 516 | |
| 517 | if lto: |
| 518 | object_file_format = ( |
| 519 | "llvm-bitcode:%s" % DOWNLOADS["llvm-aarch64-macos"]["version"] |
| 520 | ) |
| 521 | else: |
| 522 | object_file_format = "mach-o" |
| 523 | else: |
no test coverage detected