The implementation of the "configure-host" command.
(
context: argparse.Namespace,
host: str | None = None,
)
| 364 | |
| 365 | |
| 366 | def configure_host_python( |
| 367 | context: argparse.Namespace, |
| 368 | host: str | None = None, |
| 369 | ) -> None: |
| 370 | """The implementation of the "configure-host" command.""" |
| 371 | if host is None: |
| 372 | host = context.host |
| 373 | |
| 374 | if context.clean: |
| 375 | clean(context, host) |
| 376 | |
| 377 | host_dir = subdir(host, create=True) |
| 378 | prefix_dir = host_dir / "prefix" |
| 379 | |
| 380 | with group(f"Downloading dependencies ({host})"): |
| 381 | if not prefix_dir.exists(): |
| 382 | prefix_dir.mkdir() |
| 383 | cache_dir = ( |
| 384 | Path(context.cache_dir).resolve() |
| 385 | if context.cache_dir |
| 386 | else CROSS_BUILD_DIR / "downloads" |
| 387 | ) |
| 388 | unpack_deps(context.platform, host, prefix_dir, cache_dir) |
| 389 | else: |
| 390 | print("Dependencies already installed") |
| 391 | |
| 392 | with ( |
| 393 | group(f"Configuring host Python ({host})"), |
| 394 | cwd(host_dir), |
| 395 | ): |
| 396 | command = [ |
| 397 | # Basic cross-compiling configuration |
| 398 | relpath(PYTHON_DIR / "configure"), |
| 399 | f"--host={host}", |
| 400 | f"--build={sysconfig.get_config_var('BUILD_GNU_TYPE')}", |
| 401 | f"--with-build-python={build_python_path()}", |
| 402 | "--with-system-libmpdec", |
| 403 | "--enable-framework", |
| 404 | # Dependent libraries. |
| 405 | f"--with-openssl={prefix_dir}", |
| 406 | f"LIBLZMA_CFLAGS=-I{prefix_dir}/include", |
| 407 | f"LIBLZMA_LIBS=-L{prefix_dir}/lib -llzma", |
| 408 | f"LIBFFI_CFLAGS=-I{prefix_dir}/include", |
| 409 | f"LIBFFI_LIBS=-L{prefix_dir}/lib -lffi", |
| 410 | f"LIBMPDEC_CFLAGS=-I{prefix_dir}/include", |
| 411 | f"LIBMPDEC_LIBS=-L{prefix_dir}/lib -lmpdec", |
| 412 | f"LIBZSTD_CFLAGS=-I{prefix_dir}/include", |
| 413 | f"LIBZSTD_LIBS=-L{prefix_dir}/lib -lzstd", |
| 414 | ] |
| 415 | |
| 416 | if context.args: |
| 417 | command.extend(context.args) |
| 418 | run(command, host=host) |
| 419 | |
| 420 | |
| 421 | def make_host_python( |
nothing calls this directly
no test coverage detected
searching dependent graphs…