Skip to content

Commit d0726a7

Browse files
committed
Add support for metadata version 2.2 Dynamic field
1 parent 6832672 commit d0726a7

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/metadata.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use mailparse::MailHeaderMap;
66
/// Python package metadata
77
#[derive(Debug, Clone, Default, PartialEq)]
88
pub struct Metadata {
9-
/// Version of the file format; legal values are 1.0”, “1.1”, “1.2”, “2.1 and 2.2.
9+
/// Version of the file format; legal values are `1.0`, `1.1`, `1.2`, `2.1` and `2.2`.
1010
pub metadata_version: String,
1111
/// The name of the distribution.
1212
pub name: String,
@@ -33,7 +33,7 @@ pub struct Metadata {
3333
pub author: Option<String>,
3434
/// A string containing the author’s e-mail address. It can contain a name and e-mail address in the legal forms for a RFC-822 `From:` header.
3535
pub author_email: Option<String>,
36-
/// Text indicating the license covering the distribution where the license is not a selection from the License Trove classifiers.
36+
/// Text indicating the license covering the distribution where the license is not a selection from the `License` Trove classifiers.
3737
pub license: Option<String>,
3838
/// Each entry is a string giving a single classification value for the distribution.
3939
pub classifiers: Vec<String>,
@@ -67,6 +67,8 @@ pub struct Metadata {
6767
/// A string stating the markup syntax (if any) used in the distribution’s description,
6868
/// so that tools can intelligently render the description.
6969
pub description_content_type: Option<String>,
70+
/// A string containing the name of another core metadata field.
71+
pub dynamic: Vec<String>,
7072
}
7173

7274
impl Metadata {
@@ -126,6 +128,7 @@ impl Metadata {
126128
let project_urls = get_all_values("Project-URL");
127129
let provides_extras = get_all_values("Provides-Extra");
128130
let description_content_type = get_first_value("Description-Content-Type");
131+
let dynamic = get_all_values("Dynamic");
129132
Ok(Metadata {
130133
metadata_version,
131134
name,
@@ -151,6 +154,7 @@ impl Metadata {
151154
project_urls,
152155
provides_extras,
153156
description_content_type,
157+
dynamic,
154158
})
155159
}
156160
}

0 commit comments

Comments
 (0)