mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-15 09:15:00 +00:00
Do not allow local versions in Python version requests either (#7468)
Accidentally squashed https://github.com/astral-sh/uv/pull/7465 into the wrong target.
This commit is contained in:
parent
e31252e82e
commit
08a7c708d1
1 changed files with 9 additions and 2 deletions
|
@ -1718,8 +1718,8 @@ impl FromStr for VersionRequest {
|
|||
// Split the release component if it uses the wheel tag format (e.g., `38`)
|
||||
let version = split_wheel_tag_release_version(version);
|
||||
|
||||
// We dont allow post and dev versions here
|
||||
if version.post().is_some() || version.dev().is_some() {
|
||||
// We dont allow post, dev, or local versions here
|
||||
if version.post().is_some() || version.dev().is_some() || !version.local().is_empty() {
|
||||
return Err(Error::InvalidVersionRequest(s.to_string()));
|
||||
}
|
||||
|
||||
|
@ -2323,6 +2323,13 @@ mod tests {
|
|||
),
|
||||
"Development version segments are not allowed"
|
||||
);
|
||||
assert!(
|
||||
matches!(
|
||||
VersionRequest::from_str("3.12+local"),
|
||||
Err(Error::InvalidVersionRequest(_))
|
||||
),
|
||||
"Local version segments are not allowed"
|
||||
);
|
||||
assert!(
|
||||
matches!(
|
||||
VersionRequest::from_str("3.12.post0"),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue