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
)
| 511 | |
| 512 | |
| 513 | def 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 | |
| 531 | def add_licenses_to_extension_entry(entry): |