MCPcopy Index your code
hub / github.com/python/cpython / configure_host_python

Function configure_host_python

Platforms/Apple/__main__.py:366–418  ·  view source on GitHub ↗

The implementation of the "configure-host" command.

(
    context: argparse.Namespace,
    host: str | None = None,
)

Source from the content-addressed store, hash-verified

364
365
366def 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
421def make_host_python(

Callers

nothing calls this directly

Calls 13

PathClass · 0.90
relpathFunction · 0.90
cwdFunction · 0.85
cleanFunction · 0.70
subdirFunction · 0.70
groupFunction · 0.70
unpack_depsFunction · 0.70
build_python_pathFunction · 0.70
runFunction · 0.70
existsMethod · 0.45
mkdirMethod · 0.45
resolveMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…