Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd a new CARGO_PKG_AUTHORS environment variable #2465
Conversation
This comment has been minimized.
This comment has been minimized.
|
Something that has been touched upon in #2441 is how to format authors. I've gone with a |
This comment has been minimized.
This comment has been minimized.
|
Looks reasonable to me, thanks @TheNeikos! Curious what others on @rust-lang/tools think as well! |
alexcrichton
self-assigned this
Mar 11, 2016
alexcrichton
added
the
relnotes
label
Mar 11, 2016
This comment has been minimized.
This comment has been minimized.
|
Ok, got a chance to talk about this with @wycats yesterday, and the conclusion is that this seems fine to add, but for lists we probably want to go with colon-separated? Seems less likely to have a colon in the name at least other than a comma. |
This comment has been minimized.
This comment has been minimized.
|
@alexcrichton Less likely, but still possible. What about using the standard email format: Some Name some.name@example.org, "Last, First" first.last@example.com That format handles any kind of punctuation, and seems closer to what people expect with a list of names and emails. |
This comment has been minimized.
This comment has been minimized.
|
Oh this isn't necessarily for the format itself, moreso for joining two different names together (you can have multiple authors). |
This comment has been minimized.
This comment has been minimized.
|
@alexcrichton That's what I mean. If someone puts this into Cargo.toml:
then the environment variable could contain If someone decided, for whatever reason, to have an author entry like |
This comment has been minimized.
This comment has been minimized.
|
So, a colon it is then?
Would then be: Asking to clarify. This should also work for the concerns @joshtriplett brought up I think? |
This comment has been minimized.
This comment has been minimized.
|
@joshtriplett yeah although @wycats was thinking we'd use a colon instead of a comma. We currently don't have a macro to parse this out and it's possible for someone to say something like: authors = ["foo:bar", "baz"]where if we use a colon separator this would look like |
This comment has been minimized.
This comment has been minimized.
|
@alexcrichton How easily can we scan the entire ecosystem of Cargo.toml files and find out whether anyone currently uses a comma or colon in the Authors field? If Cargo bans a character there, then you can use anything you want. Otherwise, you'd want some kind of quoting/escaping, and for that, following rfc5322/rfc2822/rfc822 convention for "mailbox-list" seems like the right approach, along with requiring that each quoted string in the authors list follow the convention for one "mailbox". I feel certain that Rust has at least one compliant parser for that format, and generating it is relatively easy. |
This comment has been minimized.
This comment has been minimized.
|
Looks like colons and commas show up unfortunately. Colons show up in some HTTP addresses in the authors field and commas separate either names or multiple email addresses. |
This comment has been minimized.
This comment has been minimized.
|
@alexcrichton Odd to see HTTP URLs in the authors field; are people putting things like Regarding comma-separated names and email addresses: isn't the field a list? Are people writing |
This comment has been minimized.
This comment has been minimized.
|
Yeah that's basically what I saw from a quick grep, some names look like "last, first " I think. |
This comment has been minimized.
This comment has been minimized.
|
@alexcrichton Yeah, some businesses do that even in email headers: "Last, First" first.last@example.com What about just escaping the names in a consistent way (for instance, always wrap them in single-quotes, and escape single-quotes and backslashes with backslashes), and then putting them in the environment variable separated by anything we like? That's easy enough to reverse back into a list of strings. |
This comment has been minimized.
This comment has been minimized.
|
The problem with creating our own syntax for this is then you end up needing to create a parser as well. We've tended to avoid that in the past for things like |
This comment has been minimized.
This comment has been minimized.
|
|
TheNeikos
force-pushed the
TheNeikos:add-version_env
branch
from
07233f6
to
2a10d69
Apr 8, 2016
This comment has been minimized.
This comment has been minimized.
|
@alexcrichton Is this what was decided? Or should I put in some whitespace as well? |
alexcrichton
reviewed
Apr 8, 2016
| @@ -45,6 +45,7 @@ let version = env!("CARGO_PKG_VERSION"); | |||
| * `CARGO_PKG_VERSION_MINOR` - The minor version of your package. | |||
| * `CARGO_PKG_VERSION_PATCH` - The patch version of your package. | |||
| * `CARGO_PKG_VERSION_PRE` - The pre-release version of your package. | |||
| * `CARGO_PKG_AUTHORS` - Comma seperated list of authors from the manifest of your package. | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
TheNeikos
Apr 8, 2016
Author
Contributor
Oops you're right! Changed it in the commit, but forget here. On it.
This comment has been minimized.
This comment has been minimized.
|
Looks good to me! Just a minor nit |
TheNeikos
force-pushed the
TheNeikos:add-version_env
branch
from
2a10d69
to
dd26ce3
Apr 8, 2016
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
bors
added a commit
that referenced
this pull request
Apr 8, 2016
This comment has been minimized.
This comment has been minimized.
|
|
TheNeikos commentedMar 10, 2016
This will allow crates to use the CARGO_PKG_AUTHORS env variable to get a comma
seperated list of the authors declared in the manifest.
Closes #2441