Repository navigation
Conversation
Copying stamped wheel outputs into a dist directory currently spawns a Python interpreter per `py_wheel_dist` target. Add `//crates/py_wheel_dist:py_wheel_dist_lib`, register `py_wheel_dist` on `shrubbery`, and route `PyWheelDistDir` through `get_shrubbery_tool`. `get_shrubbery_tool` gains `files_to_run` and `is_rust` so rules can pass the resolved tool straight to `ctx.actions.run` and branch on which implementation resolved.
|
This PR was prepared by an agent under human direction. Review comments are triaged by the human author; agent-drafted replies and changes are reviewed and approved by the author before posting. This is an agent-generated comment reviewed and approved by the user. |
| /// | ||
| /// Ensures the trimmed name is non-empty and a valid single file basename without | ||
| /// path separators (`/`, `\`) or parent directory traversal (`..`). | ||
| pub fn validate_wheel_name(raw_name: &str) -> io::Result<&str> { |
There was a problem hiding this comment.
is this logic copied from the python implementation? It seems like over-defensive logic. Justify or remove
There was a problem hiding this comment.
Removed in d24c535. The Python tool just does name_file.read_text().strip() and copies, so create_wheel_dist now trims and copies with no extra validation.
This is an agent-generated comment reviewed and approved by the user.
| pub output: PathBuf, | ||
| } | ||
|
|
||
| fn parse_flagfile(content: &str, prefix: char) -> Vec<argfile::Argument> { |
There was a problem hiding this comment.
I think I've seen this same "parse flagfile" logic in several subcommands. Factor out a common library to use instead
There was a problem hiding this comment.
Done in d24c535: dropped the per-crate parse_flagfile and the bare-@ pre-check and call argfile::expand_args_from(..., argfile::parse_fromfile, argfile::PREFIX) directly, same as zipper/zip_main_maker/wheelmaker. The remaining subcommands in the stack get the same treatment on their own levels so there is no bespoke flagfile logic left to factor out.
This is an agent-generated comment reviewed and approved by the user.
| Short('h') | Long("help") => { | ||
| return Err( | ||
| "Usage: py_wheel_dist --wheel <path> --name_file <path> --output <path>" | ||
| .to_string(), | ||
| ); | ||
| } |
There was a problem hiding this comment.
Follow the pattern of the other tools and have a USAGE constant instead of an inline usage string
There was a problem hiding this comment.
Done in d24c535: USAGE constant plus Cli::Help, printed to stdout with exit 0 like the other tools.
This is an agent-generated comment reviewed and approved by the user.
| ); | ||
| } | ||
| Long("wheel") => wheel = Some(parse_non_empty_path(&mut parser, "--wheel")?), | ||
| Long("name_file") => { |
There was a problem hiding this comment.
Follow the pattern of the other tools and use symbolic constants instead of string literals.
There was a problem hiding this comment.
Done in d24c535: added a keep-sorted flags module and switched the match arms and error messages to its constants.
This is an agent-generated comment reviewed and approved by the user.
| } | ||
| return Err(format!("unexpected argument: --{other}")); | ||
| } | ||
| Short(ch) => { |
There was a problem hiding this comment.
Don't bother to support short arguments. Keep it simple and just have long arguments.
There was a problem hiding this comment.
Done in d24c535: the Short(..)/Long(other)/Value(..) arms are replaced by a single _ => bail!("{}", arg.unexpected()). -h stays as the one short flag, matching the other subcommands.
This is an agent-generated comment reviewed and approved by the user.
Drop the wheel-name validation that the Python tool never had, use argfile's parse_fromfile directly instead of a per-crate flagfile parser, and adopt the USAGE constant, flags module, anyhow errors, and long-only arguments used by the other shrubbery subcommands.
Drop the wheel-name validation that the Python tool never had, use
argfile's parse_fromfile directly instead of a per-crate flagfile
parser, and adopt the USAGE constant, flags module, anyhow errors, and
long-only arguments used by the other shrubbery subcommands.