Skip to content

Commit 7c3d3ed

Browse files
committed
Only serialize fields that PyPI accepts
1 parent 3a82cf5 commit 7c3d3ed

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/metadata.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
use std::str::FromStr;
22

3-
use crate::Error;
43
use mailparse::MailHeaderMap;
54
#[cfg(feature = "serde")]
65
use serde::{Deserialize, Serialize};
76

7+
use crate::Error;
8+
89
/// Python package metadata
910
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]
1011
#[derive(Debug, Clone, Default, PartialEq)]
@@ -17,9 +18,11 @@ pub struct Metadata {
1718
pub version: String,
1819
/// A Platform specification describing an operating system supported by the distribution
1920
/// which is not listed in the “Operating System” Trove classifiers.
21+
#[cfg_attr(feature = "serde", serde(rename = "platform"))]
2022
pub platforms: Vec<String>,
2123
/// Binary distributions containing a PKG-INFO file will use the Supported-Platform field
2224
/// in their metadata to specify the OS and CPU for which the binary distribution was compiled.
25+
#[cfg_attr(feature = "serde", serde(skip_serializing))]
2326
pub supported_platforms: Vec<String>,
2427
/// A one-line summary of what the distribution does.
2528
pub summary: Option<String>,
@@ -66,11 +69,13 @@ pub struct Metadata {
6669
pub project_urls: Vec<String>,
6770
/// A string containing the name of an optional feature. Must be a valid Python identifier.
6871
/// May be used to make a dependency conditional on whether the optional feature has been requested.
72+
#[cfg_attr(feature = "serde", serde(skip_serializing))]
6973
pub provides_extras: Vec<String>,
7074
/// A string stating the markup syntax (if any) used in the distribution’s description,
7175
/// so that tools can intelligently render the description.
7276
pub description_content_type: Option<String>,
7377
/// A string containing the name of another core metadata field.
78+
#[cfg_attr(feature = "serde", serde(skip_serializing))]
7479
pub dynamic: Vec<String>,
7580
}
7681

0 commit comments

Comments
 (0)