MCPcopy
hub / github.com/astral-sh/python-build-standalone / create_tar_from_directory

Function create_tar_from_directory

pythonbuild/utils.py:378–388  ·  view source on GitHub ↗
(fh, base_path: pathlib.Path, path_prefix=None)

Source from the content-addressed store, hash-verified

376
377
378def create_tar_from_directory(fh, base_path: pathlib.Path, path_prefix=None):
379 with tarfile.open(name="", mode="w", fileobj=fh) as tf:
380 for root, dirs, files in os.walk(base_path):
381 dirs.sort()
382
383 for f in sorted(files):
384 full = base_path / root / f
385 rel = full.relative_to(base_path)
386 if path_prefix:
387 rel = pathlib.Path(path_prefix) / rel
388 tf.add(full, rel)
389
390
391def extract_tar_to_directory(source: pathlib.Path, dest: pathlib.Path):

Callers 7

build_opensslFunction · 0.90
build_libffiFunction · 0.90
build_cpythonFunction · 0.90
build_cpython_hostFunction · 0.90
build_cpythonFunction · 0.90
get_tools_archiveMethod · 0.85
get_output_archiveMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected