Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set the CARGO_PKG_README environment variable #11597

Closed
nagisa opened this issue Jan 18, 2023 · 2 comments · Fixed by #11645
Closed

Set the CARGO_PKG_README environment variable #11597

nagisa opened this issue Jan 18, 2023 · 2 comments · Fixed by #11645
Assignees
Labels
A-environment-variables Area: environment variables C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` E-easy Experience: Easy

Comments

@nagisa
Copy link
Member

nagisa commented Jan 18, 2023

Problem

Cargo may rewrite the package’s Cargo.toml and move the README file around, relative to the manifest. I would like to include_str!() this README in my lib.rs, but am unable to do so right now, because if I specify include_str!("../../README") it works for development, but I can’t package my crate. Conversely if I specify include_str!("../README") it works when packaged, but not during development.

Proposed Solution

Having an environment variable that would tell me where to find the README file would probably be the most straightforward option.

Notes

No response

@nagisa nagisa added the C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` label Jan 18, 2023
@weihanglo
Copy link
Member

To me, it seems fine to add a new environment variable. You could follow how other environments were added. Basically you will

  • Set a new environment variable here
  • Add an explanation here for the new variable.
  • Assert the new variable has been set in this test.
  • Submit a pull request with a explanation why this is useful with a clear use case.

The Cargo team would probably do an FCP for that before merging.

@weihanglo weihanglo added E-easy Experience: Easy A-environment-variables Area: environment variables labels Jan 20, 2023
@chansuke
Copy link
Contributor

@rustbot claim

@bors bors closed this as completed in c1334b0 Mar 7, 2023
tmfink added a commit to capstone-rust/capstone-rs that referenced this issue Feb 25, 2024
Works around "cargo publish" error:
rust-lang/cargo#11597

Also replace README with symlink to repo's root README.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-environment-variables Area: environment variables C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` E-easy Experience: Easy
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants