Visit source distributions before wheels (#10291)

## Summary

This should address the comment here:
https://github.com/astral-sh/uv/pull/10179#issuecomment-2569189265. We
don't compute implied markers if the marker is already `TRUE`, and we
set it to `TRUE` as soon as we see a source distribution. So if we visit
the source distribution before the wheels, we'll avoid computing these
for any irrelevant distributions.
This commit is contained in:
Charlie Marsh 2025-01-03 12:07:29 -05:00 committed by GitHub
parent 9f1ba2b967
commit 5b334313e5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 7 deletions

View File

@ -786,15 +786,13 @@ impl VersionFiles {
}
pub fn all(self) -> impl Iterator<Item = (DistFilename, File)> {
self.wheels
.into_iter()
.map(|VersionWheel { name, file }| (DistFilename::WheelFilename(name), file))
.chain(
self.source_dists
.into_iter()
.map(|VersionSourceDist { name, file }| {
(DistFilename::SourceDistFilename(name), file)
}),
.map(|VersionSourceDist { name, file }| (DistFilename::SourceDistFilename(name), file))
.chain(
self.wheels
.into_iter()
.map(|VersionWheel { name, file }| (DistFilename::WheelFilename(name), file)),
)
}
}

View File

@ -638,7 +638,9 @@ pub fn implied_markers(filename: &WheelFilename) -> MarkerTree {
let mut marker = MarkerTree::FALSE;
for platform_tag in &filename.platform_tag {
match platform_tag.as_str() {
"any" => marker.or(MarkerTree::TRUE),
"any" => {
return MarkerTree::TRUE;
}
tag if tag.starts_with("win") => {
marker.or(MarkerTree::expression(MarkerExpression::String {
key: MarkerValueString::SysPlatform,