File tree 1 file changed +21
-2
lines changed
1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -2074,11 +2074,30 @@ impl FromStr for VersionRequest {
2074
2074
// Split the release component if it uses the wheel tag format (e.g., `38`)
2075
2075
let version = split_wheel_tag_release_version ( version) ;
2076
2076
2077
- // We dont allow post, dev, or local versions here
2078
- if version. post ( ) . is_some ( ) || version. dev ( ) . is_some ( ) || !version . local ( ) . is_empty ( ) {
2077
+ // We dont allow post or dev version here
2078
+ if version. post ( ) . is_some ( ) || version. dev ( ) . is_some ( ) {
2079
2079
return Err ( Error :: InvalidVersionRequest ( s. to_string ( ) ) ) ;
2080
2080
}
2081
2081
2082
+ // Check if the local version includes a variant
2083
+ let variant = if version. local ( ) . is_empty ( ) {
2084
+ variant
2085
+ } else {
2086
+ // If we already have a variant, do not allow another to be requested
2087
+ if variant != PythonVariant :: Default {
2088
+ return Err ( Error :: InvalidVersionRequest ( s. to_string ( ) ) ) ;
2089
+ }
2090
+
2091
+ let [ uv_pep440:: LocalSegment :: String ( local) ] = version. local ( ) else {
2092
+ return Err ( Error :: InvalidVersionRequest ( s. to_string ( ) ) ) ;
2093
+ } ;
2094
+
2095
+ match local. as_str ( ) {
2096
+ "freethreaded" => PythonVariant :: Freethreaded ,
2097
+ _ => return Err ( Error :: InvalidVersionRequest ( s. to_string ( ) ) ) ,
2098
+ }
2099
+ } ;
2100
+
2082
2101
// Cast the release components into u8s since that's what we use in `VersionRequest`
2083
2102
let Ok ( release) = try_into_u8_slice ( version. release ( ) ) else {
2084
2103
return Err ( Error :: InvalidVersionRequest ( s. to_string ( ) ) ) ;
You can’t perform that action at this time.
0 commit comments