mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-24 13:43:45 +00:00
Fix uv python pin 3.13t
failure when parsing version for project requires check (#8056)
Closes https://github.com/astral-sh/uv/issues/7964 We can probably do some restructuring to avoid unwrapping here in the future, but this just fixes the bug quick.
This commit is contained in:
parent
46a0ed7fa2
commit
82708944a3
3 changed files with 43 additions and 4 deletions
|
@ -1952,6 +1952,29 @@ impl VersionRequest {
|
|||
| Self::Range(_, variant) => variant == &PythonVariant::Freethreaded,
|
||||
}
|
||||
}
|
||||
|
||||
/// Return a new [`VersionRequest`] with the [`PythonVariant`] if it has one.
|
||||
///
|
||||
/// This is useful for converting the string representation to pep440.
|
||||
#[must_use]
|
||||
pub fn without_python_variant(self) -> Self {
|
||||
// TODO(zanieb): Replace this entire function with a utility that casts this to a version
|
||||
// without using `VersionRequest::to_string`.
|
||||
match self {
|
||||
Self::Any | Self::Default => self,
|
||||
Self::Major(major, _) => Self::Major(major, PythonVariant::Default),
|
||||
Self::MajorMinor(major, minor, _) => {
|
||||
Self::MajorMinor(major, minor, PythonVariant::Default)
|
||||
}
|
||||
Self::MajorMinorPatch(major, minor, patch, _) => {
|
||||
Self::MajorMinorPatch(major, minor, patch, PythonVariant::Default)
|
||||
}
|
||||
Self::MajorMinorPrerelease(major, minor, prerelease, _) => {
|
||||
Self::MajorMinorPrerelease(major, minor, prerelease, PythonVariant::Default)
|
||||
}
|
||||
Self::Range(specifiers, _) => Self::Range(specifiers, PythonVariant::Default),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl FromStr for VersionRequest {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue