MCPcopy Index your code
hub / github.com/astral-sh/python-build-standalone / extract_python_archive

Function extract_python_archive

pythonbuild/utils.py:513–528  ·  view source on GitHub ↗

Extract a PBS .tar.zst distribution archive to the given directory. Returns the path to the `python` directory, which is equivalent to `dest_dir / "python"`.

(
    archive: pathlib.Path, dest_dir: pathlib.Path
)

Source from the content-addressed store, hash-verified

511
512
513def extract_python_archive(
514 archive: pathlib.Path, dest_dir: pathlib.Path
515) -> pathlib.Path:
516 """Extract a PBS .tar.zst distribution archive to the given directory.
517
518 Returns the path to the `python` directory, which is equivalent to
519 `dest_dir / "python"`.
520 """
521 with archive.open("rb") as fh:
522 dctx = zstandard.ZstdDecompressor()
523 with dctx.stream_reader(fh) as reader:
524 with tarfile.open(mode="r|", fileobj=reader) as tf:
525 dest_dir.mkdir(exist_ok=True, parents=True)
526 tf.extractall(dest_dir)
527
528 return dest_dir / "python"
529
530
531def add_licenses_to_extension_entry(entry):

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by 1

mainFunction · 0.68