Avoid excluding valid wheels for exact requires-python bounds (#8140)

## Summary

Closes https://github.com/astral-sh/uv/issues/8136.
This commit is contained in:
Charlie Marsh
2024-10-12 06:17:36 +02:00
committed by GitHub
parent 7362f84d6f
commit b91bd29970
3 changed files with 109 additions and 7 deletions
+8 -7
View File
@@ -350,8 +350,8 @@ impl RequiresPython {
return true;
};
// Ex) If the wheel bound is `3.12`, then it doesn't match `==3.10.*`.
let wheel_bound = UpperBound(Bound::Excluded(Version::new([3, minor + 1])));
// Ex) If the wheel bound is `3.12`, then it doesn't match `<=3.10.`.
let wheel_bound = UpperBound(Bound::Included(Version::new([3, minor])));
if wheel_bound > self.range.upper().major_minor() {
return false;
}
@@ -375,7 +375,8 @@ impl RequiresPython {
return false;
}
let wheel_bound = UpperBound(Bound::Excluded(Version::new([3, minor + 1])));
// Ex) If the wheel bound is `3.12`, then it doesn't match `<=3.10.`.
let wheel_bound = UpperBound(Bound::Included(Version::new([3, minor])));
if wheel_bound > self.range.upper().major_minor() {
return false;
}
@@ -403,8 +404,8 @@ impl RequiresPython {
return false;
}
// Ex) If the wheel bound is `3.12`, then it doesn't match `==3.10.*`.
let wheel_bound = UpperBound(Bound::Excluded(Version::new([3, minor + 1])));
// Ex) If the wheel bound is `3.12`, then it doesn't match `<=3.10.`.
let wheel_bound = UpperBound(Bound::Included(Version::new([3, minor])));
if wheel_bound > self.range.upper().major_minor() {
return false;
}
@@ -428,8 +429,8 @@ impl RequiresPython {
return false;
}
// Ex) If the wheel bound is `3.12`, then it doesn't match `==3.10.*`.
let wheel_bound = UpperBound(Bound::Excluded(Version::new([3, minor + 1])));
// Ex) If the wheel bound is `3.12`, then it doesn't match `<=3.10.`.
let wheel_bound = UpperBound(Bound::Included(Version::new([3, minor])));
if wheel_bound > self.range.upper().major_minor() {
return false;
}