Skip to content

Provide a json output format of cargo package --list  #11666

Closed
@messense

Description

@messense

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

README.md

instead of

../README.md

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Command-packageS-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions