From a10235ea672d0cfae2949beca0478b7c3b2eafb0 Mon Sep 17 00:00:00 2001 From: Rogdham <3994389+Rogdham@users.noreply.github.com> Date: Wed, 23 Jul 2025 20:09:53 +0200 Subject: [PATCH 1/2] gh-132983: Add missing references to Zstandard in shutil docstrings (GH-136617) Zstd references in shutil docstrings --- Lib/shutil.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Lib/shutil.py b/Lib/shutil.py index ca0a2ea2f7fa8a..8d8fe145567822 100644 --- a/Lib/shutil.py +++ b/Lib/shutil.py @@ -994,14 +994,14 @@ def _make_tarball(base_name, base_dir, compress="gzip", verbose=0, dry_run=0, """Create a (possibly compressed) tar file from all the files under 'base_dir'. - 'compress' must be "gzip" (the default), "bzip2", "xz", or None. + 'compress' must be "gzip" (the default), "bzip2", "xz", "zst", or None. 'owner' and 'group' can be used to define an owner and a group for the archive that is being built. If not provided, the current owner and group will be used. The output tar file will be named 'base_name' + ".tar", possibly plus - the appropriate compression extension (".gz", ".bz2", or ".xz"). + the appropriate compression extension (".gz", ".bz2", ".xz", or ".zst"). Returns the output filename. """ @@ -1187,7 +1187,7 @@ def make_archive(base_name, format, root_dir=None, base_dir=None, verbose=0, 'base_name' is the name of the file to create, minus any format-specific extension; 'format' is the archive format: one of "zip", "tar", "gztar", - "bztar", "zstdtar", or "xztar". Or any other registered format. + "bztar", "xztar", or "zstdtar". Or any other registered format. 'root_dir' is a directory that will be the root directory of the archive; ie. we typically chdir into 'root_dir' before creating the @@ -1337,7 +1337,7 @@ def _unpack_zipfile(filename, extract_dir): zip.close() def _unpack_tarfile(filename, extract_dir, *, filter=None): - """Unpack tar/tar.gz/tar.bz2/tar.xz `filename` to `extract_dir` + """Unpack tar/tar.gz/tar.bz2/tar.xz/tar.zst `filename` to `extract_dir` """ import tarfile # late import for breaking circular dependency try: @@ -1392,7 +1392,7 @@ def unpack_archive(filename, extract_dir=None, format=None, *, filter=None): is unpacked. If not provided, the current working directory is used. `format` is the archive format: one of "zip", "tar", "gztar", "bztar", - or "xztar". Or any other registered format. If not provided, + "xztar", or "zstdtar". Or any other registered format. If not provided, unpack_archive will use the filename extension and see if an unpacker was registered for that extension. From ec7fad79d24e79961b86e17177a32b32bb340fe5 Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Wed, 23 Jul 2025 11:50:15 -0700 Subject: [PATCH 2/2] Touch up `Setup.local` handling in `Tools/wasm/wasi` (GH-137051) The comment in the generated file is now more self-explanatory. The checks for unexpected file contents are also strengthened. --- Tools/wasm/wasi/__main__.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Tools/wasm/wasi/__main__.py b/Tools/wasm/wasi/__main__.py index 54ccc95157d57d..f3c97ff3fd11a0 100644 --- a/Tools/wasm/wasi/__main__.py +++ b/Tools/wasm/wasi/__main__.py @@ -23,7 +23,8 @@ BUILD_DIR = CROSS_BUILD_DIR / "build" LOCAL_SETUP = CHECKOUT / "Modules" / "Setup.local" -LOCAL_SETUP_MARKER = "# Generated by Tools/wasm/wasi.py\n".encode("utf-8") +LOCAL_SETUP_MARKER = ("# Generated by Tools/wasm/wasi .\n" + "# Required to statically build extension modules.").encode("utf-8") WASMTIME_VAR_NAME = "WASMTIME" WASMTIME_HOST_RUNNER_VAR = f"{{{WASMTIME_VAR_NAME}}}" @@ -141,9 +142,12 @@ def build_python_is_pydebug(): def configure_build_python(context, working_dir): """Configure the build/host Python.""" if LOCAL_SETUP.exists(): - print(f"๐Ÿ‘ {LOCAL_SETUP} exists ...") + if LOCAL_SETUP.read_bytes() == LOCAL_SETUP_MARKER: + print(f"๐Ÿ‘ {LOCAL_SETUP} exists ...") + else: + print(f"โš ๏ธ {LOCAL_SETUP} exists, but has unexpected contents") else: - print(f"๐Ÿ“ Touching {LOCAL_SETUP} ...") + print(f"๐Ÿ“ Creating {LOCAL_SETUP} ...") LOCAL_SETUP.write_bytes(LOCAL_SETUP_MARKER) configure = [os.path.relpath(CHECKOUT / 'configure', working_dir)] @@ -297,9 +301,8 @@ def clean_contents(context): shutil.rmtree(CROSS_BUILD_DIR) if LOCAL_SETUP.exists(): - with LOCAL_SETUP.open("rb") as file: - if file.read(len(LOCAL_SETUP_MARKER)) == LOCAL_SETUP_MARKER: - print(f"๐Ÿงน Deleting generated {LOCAL_SETUP} ...") + if LOCAL_SETUP.read_bytes() == LOCAL_SETUP_MARKER: + print(f"๐Ÿงน Deleting generated {LOCAL_SETUP} ...") def main():