Skip to content
This repository has been archived by the owner on Oct 17, 2024. It is now read-only.

Commit

Permalink
Don't sort and de-duplicate based on canonical name only (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk authored Jul 3, 2024
1 parent e575a61 commit f7f388e
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion rust/src/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ pub fn fix(
}
"dependencies" | "optional-dependencies" => {
transform(entry, &|s| format_requirement(s, keep_full_version));
sort(entry, |e| get_canonic_requirement_name(e).to_lowercase());
sort(entry, |e| get_canonic_requirement_name(e).to_lowercase() + " " + &format_requirement(e, keep_full_version));
}
"dynamic" | "keywords" => {
transform(entry, &|s| String::from(s));
Expand Down Expand Up @@ -716,6 +716,32 @@ mod tests {
true,
(3, 12),
)]
#[case::project_platform_dependencies(
indoc ! {r#"
[project]
dependencies = [
'pyperclip; platform_system == "Darwin"',
'pyperclip; platform_system == "Windows"',
"appdirs"
]
requires-python = "==3.12"
"#},
indoc ! {r#"
[project]
requires-python = "==3.12"
classifiers = [
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.12",
]
dependencies = [
"appdirs",
"pyperclip; platform_system=='Darwin'",
"pyperclip; platform_system=='Windows'",
]
"#},
true,
(3, 12),
)]
#[case::project_opt_inline_dependencies(
indoc ! {r#"
[project]
Expand Down

0 comments on commit f7f388e

Please sign in to comment.