mirror of https://github.com/astral-sh/uv
parent
2a02c600c8
commit
b648980625
|
|
@ -553,33 +553,7 @@ impl VersionSpecifier {
|
||||||
// pypa/packaging disagrees: https://github.com/pypa/packaging/issues/617
|
// pypa/packaging disagrees: https://github.com/pypa/packaging/issues/617
|
||||||
other.as_ref() >= this
|
other.as_ref() >= this
|
||||||
}
|
}
|
||||||
Operator::GreaterThan => Self::greater_than(this, &other),
|
Operator::GreaterThan => {
|
||||||
Operator::GreaterThanEqual => other.as_ref() >= this,
|
|
||||||
Operator::LessThan => Self::less_than(this, &other),
|
|
||||||
Operator::LessThanEqual => other.as_ref() <= this,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn less_than(this: &Version, other: &Version) -> bool {
|
|
||||||
if other.epoch() < this.epoch() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// The exclusive ordered comparison <V MUST NOT allow a pre-release of the specified
|
|
||||||
// version unless the specified version is itself a pre-release. E.g., <3.1 should
|
|
||||||
// not match 3.1.dev0, but should match both 3.0.dev0 and 3.0, while <3.1.dev1 does match
|
|
||||||
// 3.1.dev0, 3.0.dev0 and 3.0.
|
|
||||||
if version::compare_release(&this.release(), &other.release()) == Ordering::Equal
|
|
||||||
&& !this.any_prerelease()
|
|
||||||
&& other.any_prerelease()
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
other < this
|
|
||||||
}
|
|
||||||
|
|
||||||
fn greater_than(this: &Version, other: &Version) -> bool {
|
|
||||||
if other.epoch() > this.epoch() {
|
if other.epoch() > this.epoch() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -599,7 +573,29 @@ impl VersionSpecifier {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
other > this
|
other.as_ref() > this
|
||||||
|
}
|
||||||
|
Operator::GreaterThanEqual => other.as_ref() >= this,
|
||||||
|
Operator::LessThan => {
|
||||||
|
if other.epoch() < this.epoch() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// The exclusive ordered comparison <V MUST NOT allow a pre-release of the specified
|
||||||
|
// version unless the specified version is itself a pre-release. E.g., <3.1 should
|
||||||
|
// not match 3.1.dev0, but should match both 3.0.dev0 and 3.0, while <3.1.dev1 does
|
||||||
|
// match 3.1.dev0, 3.0.dev0 and 3.0.
|
||||||
|
if version::compare_release(&this.release(), &other.release()) == Ordering::Equal
|
||||||
|
&& !this.any_prerelease()
|
||||||
|
&& other.any_prerelease()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
other.as_ref() < this
|
||||||
|
}
|
||||||
|
Operator::LessThanEqual => other.as_ref() <= this,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Whether this version specifier rejects versions below a lower cutoff.
|
/// Whether this version specifier rejects versions below a lower cutoff.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue