From 67ea397a3142a6e2bbecab13170fff5fe8a0cccc Mon Sep 17 00:00:00 2001 From: Matthew Donoughe Date: Wed, 9 Aug 2023 15:16:42 -0400 Subject: [PATCH 1/3] add license-expression support --- src/metadata.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/metadata.rs b/src/metadata.rs index bc22b1d..1e23f8e 100644 --- a/src/metadata.rs +++ b/src/metadata.rs @@ -46,9 +46,12 @@ pub struct Metadata { /// 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. #[cfg_attr(feature = "serde", serde(default))] pub author_email: Option, - /// Text indicating the license covering the distribution where the license is not a selection from the `License` Trove classifiers. + /// Text indicating the license covering the distribution where the license is not a selection from the `License` Trove classifiers or an SPDX license expression. #[cfg_attr(feature = "serde", serde(default))] pub license: Option, + /// An SPDX expression indicating the license covering the distribution. + #[cfg_attr(feature = "serde", serde(default))] + pub license_expression: Option, /// Each entry is a string giving a single classification value for the distribution. #[cfg_attr(feature = "serde", serde(default))] pub classifiers: Vec, @@ -152,6 +155,7 @@ impl Metadata { let author = get_first_value("Author"); let author_email = get_first_value("Author-email"); let license = get_first_value("License"); + let license_expression = get_first_value("License-Expression"); let classifiers = get_all_values("Classifier"); let requires_dist = get_all_values("Requires-Dist"); let provides_dist = get_all_values("Provides-Dist"); @@ -178,6 +182,7 @@ impl Metadata { author, author_email, license, + license_expression, classifiers, requires_dist, provides_dist, From 8fc8622b88f1eec7461e16a92fdcbe3942d4dc55 Mon Sep 17 00:00:00 2001 From: Matthew Donoughe Date: Wed, 9 Aug 2023 15:21:12 -0400 Subject: [PATCH 2/3] add License-File as well --- src/metadata.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/metadata.rs b/src/metadata.rs index 1e23f8e..63e8a0e 100644 --- a/src/metadata.rs +++ b/src/metadata.rs @@ -52,6 +52,9 @@ pub struct Metadata { /// An SPDX expression indicating the license covering the distribution. #[cfg_attr(feature = "serde", serde(default))] pub license_expression: Option, + /// The path to a file containing the text of the license covering the distribution. + #[cfg_attr(feature = "serde", serde(default))] + pub license_file: Option, /// Each entry is a string giving a single classification value for the distribution. #[cfg_attr(feature = "serde", serde(default))] pub classifiers: Vec, @@ -156,6 +159,7 @@ impl Metadata { let author_email = get_first_value("Author-email"); let license = get_first_value("License"); let license_expression = get_first_value("License-Expression"); + let license_file = get_first_value("License-File"); let classifiers = get_all_values("Classifier"); let requires_dist = get_all_values("Requires-Dist"); let provides_dist = get_all_values("Provides-Dist"); @@ -183,6 +187,7 @@ impl Metadata { author_email, license, license_expression, + license_file, classifiers, requires_dist, provides_dist, From 221644ac0683a54ca715147a69095ed24f7cbb8b Mon Sep 17 00:00:00 2001 From: Matthew Donoughe Date: Wed, 9 Aug 2023 15:48:44 -0400 Subject: [PATCH 3/3] License-File is a multi-use field --- src/metadata.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/metadata.rs b/src/metadata.rs index 63e8a0e..022cd25 100644 --- a/src/metadata.rs +++ b/src/metadata.rs @@ -52,9 +52,9 @@ pub struct Metadata { /// An SPDX expression indicating the license covering the distribution. #[cfg_attr(feature = "serde", serde(default))] pub license_expression: Option, - /// The path to a file containing the text of the license covering the distribution. + /// Paths to files containing the text of the licenses covering the distribution. #[cfg_attr(feature = "serde", serde(default))] - pub license_file: Option, + pub license_files: Vec, /// Each entry is a string giving a single classification value for the distribution. #[cfg_attr(feature = "serde", serde(default))] pub classifiers: Vec, @@ -159,7 +159,7 @@ impl Metadata { let author_email = get_first_value("Author-email"); let license = get_first_value("License"); let license_expression = get_first_value("License-Expression"); - let license_file = get_first_value("License-File"); + let license_files = get_all_values("License-File"); let classifiers = get_all_values("Classifier"); let requires_dist = get_all_values("Requires-Dist"); let provides_dist = get_all_values("Provides-Dist"); @@ -187,7 +187,7 @@ impl Metadata { author_email, license, license_expression, - license_file, + license_files, classifiers, requires_dist, provides_dist,