Skip to content

Commit

Permalink
Fix license line ending in wheel metadata for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
messense committed Mar 8, 2022
1 parent 722bcea commit f237c38
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,7 @@ fn fold_header(text: &str) -> String {
if i > 0 {
result.push_str("\r\n");
}
let line = line.trim_end();
if line.is_empty() {
result.push('\t');
} else {
Expand Down Expand Up @@ -794,6 +795,29 @@ mod test {
let content = metadata.to_file_contents();
let pkginfo: Result<python_pkginfo::Metadata, _> = content.parse();
assert!(pkginfo.is_ok());

let license = metadata
.to_vec()
.into_iter()
.filter_map(|(key, val)| {
if key.starts_with("License") {
Some(val)
} else {
None
}
})
.next()
.unwrap();
let mut lines = license.split_inclusive('\n');
assert_eq!(
lines.next().unwrap(),
"Copyright (c) 2018-present konstin\r\n"
);
assert_eq!(lines.next().unwrap(), "\t\r\n");
assert_eq!(
lines.next().unwrap(),
"\tPermission is hereby granted, free of charge, to any\r\n"
);
}

#[test]
Expand Down

0 comments on commit f237c38

Please sign in to comment.