Repository navigation
Conversation
Replace the Python `zip_main_maker` used by `py_zipapp`'s `PyZipAppCreateMainPy` action with a Rust implementation. Together with `exe_zip_maker` and `zipper`, all `py_zipapp` zip actions now run through `shrubbery` without invoking a Python interpreter when `shrubbery` is resolved. `crates/zip_main_maker` mirrors `tools/zipapp/zip_main_maker.py`: it parses the same CLI and `@flagfile` flags, hashes sorted manifest lines and file contents or symlink targets with SHA-256 across regular, symlink, inferred-symlink (`-1`), empty, and explicit-symlink entries, and applies template substitutions. `py_zipapp` selects the `zip_main_maker` subcommand via `get_shrubbery_tool` and falls back to the Python tool when no `shrubbery` toolchain is resolved. * Also extract `crates/zip_manifest` so `zipper` and `zip_main_maker` share `|`-delimited manifest line and `is_symlink` parsing. * Also return `std::process::ExitCode` instead of `i32` or `process::exit` from `shrubbery` and its subcommand crates. * Also document in agent guidance that `# buildifier: disable=bzl-visibility` is allowed on repo-internal `/private/` helper loads in non-`python/` packages such as `crates/` and `tools/`. Work towards bazel-contrib#4250
|
This PR was prepared with AI agent assistance and verified locally by the author. Review comments on this PR will be handled directly by the human author, or reviewed and approved by the human author before any agent-assisted reply is posted. This is an automatically generated agent comment. |
On non-Unix targets, the `#[cfg(unix)]` symlink entry block in
`test_creates_zip_main` is compiled out, leaving `vec![...]` borrowed
only for `.join("\n")` and triggering `-D clippy::useless-vec`.
Join a fixed-size array into a string and append the symlink entry by
rebinding on Unix so Clippy passes on both Unix and Windows.
Yeah! https://doc.rust-lang.org/book/ch10-03-lifetime-syntax.html You don't see lifetimes often because the compiler can infer them in a lot of common cases: https://doc.rust-lang.org/nomicon/lifetime-elision.html |
Solumin
left a comment
There was a problem hiding this comment.
Nothing stands out to me as particularly bad --- which is a bit suspicious in its own right. ;)
|
I've been doing pre-reviews interrogating anything I don't entirely understand. Something I asked it about (but haven't looked back at yet) were the string literals for case matching, which seem like easy typos |
Replace repeated subcommand, CLI flag, and manifest wire-token string literals in `match` arms and error messages with module-qualified constants so mismatches fail to compile instead of falling through to wildcard arms or binding catch-all pattern variables.
Replace the Python
zip_main_makerused bypy_zipapp'sPyZipAppCreateMainPyaction with a Rust implementation. Together withexe_zip_makerandzipper, allpy_zipappzip actions now runthrough
shrubberywithout invoking a Python interpreter whenshrubberyis resolved.crates/zip_main_makermirrorstools/zipapp/zip_main_maker.py: itparses the same CLI and
@flagfileflags, hashes sorted manifest linesand file contents or symlink targets with SHA-256 across regular,
symlink, inferred-symlink (
-1), empty, and explicit-symlink entries,and applies template substitutions.
py_zipappselects thezip_main_makersubcommand viaget_shrubbery_tooland falls back tothe Python tool when no
shrubberytoolchain is resolved.crates/zip_manifestsozipperandzip_main_makershare
|-delimited manifest line andis_symlinkparsing.std::process::ExitCodeinstead ofi32orprocess::exitfromshrubberyand its subcommand crates.# buildifier: disable=bzl-visibilityis allowed on repo-internal/private/helper loads in non-python/packages such ascrates/and
tools/.Work towards #4250