Provide a json output format of cargo package --list · Issue #11666 · rust-lang/cargo (original) (raw)

Problem

Currently cargo package --list outputs filenames line by line, it works fine normally. But when Cargo.toml contains metadata that uses relative path to point to parent directory, there is no way to get that information. For example readme = "../README.md:

[package] readme = "../README.md"

cargo package --list outputs

instead of

It makes sense because it's the filesystem layout in the .crate file, but for downstream tooling like maturin it doesn't know that the READMD.md is actually coming from ../README.md, which causes PyO3/maturin#1431

Proposed Solution

Add a json output format, for example cargo package --list=json outputs something like

{ "README.md": "../README.md", "src/lib.rs": "src/lib.rs" }

as proposed by @konstin in PyO3/maturin#1442 (comment)

Notes

No response