@@ -1072,12 +1072,26 @@ pub fn find_best_python_installation(
1072
1072
) -> Result < FindPythonResult , Error > {
1073
1073
debug ! ( "Starting Python discovery for {}" , request) ;
1074
1074
1075
+ // fn handle_result(result: Result<FindPythonResult, Error>) -> Option<FindPythonResult> {
1076
+ // let discovery_err = match result {
1077
+ // Ok(python_result) => {
1078
+
1079
+ // }
1080
+ // }
1081
+ // }
1082
+
1075
1083
// First, check for an exact match (or the first available version if no Python version was provided)
1076
1084
debug ! ( "Looking for exact match for request {request}" ) ;
1077
- let result = find_python_installation ( request, environments, preference, cache) ?;
1078
- if let Ok ( ref installation) = result {
1079
- warn_on_unsupported_python ( installation. interpreter ( ) ) ;
1080
- return Ok ( result) ;
1085
+ let result = find_python_installation ( request, environments, preference, cache) ;
1086
+ match result {
1087
+ Ok ( Ok ( installation) ) => {
1088
+ warn_on_unsupported_python ( installation. interpreter ( ) ) ;
1089
+ return Ok ( Ok ( installation) ) ;
1090
+ }
1091
+ // Continue if we can't find a matching Python and ignore non-critical discovery errors
1092
+ Ok ( Err ( _) ) => { }
1093
+ Err ( ref err) if !err. is_critical ( ) => { }
1094
+ _ => return result,
1081
1095
}
1082
1096
1083
1097
// If that fails, and a specific patch version was requested try again allowing a
@@ -1096,10 +1110,16 @@ pub fn find_best_python_installation(
1096
1110
_ => None ,
1097
1111
} {
1098
1112
debug ! ( "Looking for relaxed patch version {request}" ) ;
1099
- let result = find_python_installation ( & request, environments, preference, cache) ?;
1100
- if let Ok ( ref installation) = result {
1101
- warn_on_unsupported_python ( installation. interpreter ( ) ) ;
1102
- return Ok ( result) ;
1113
+ let result = find_python_installation ( & request, environments, preference, cache) ;
1114
+ match result {
1115
+ Ok ( Ok ( installation) ) => {
1116
+ warn_on_unsupported_python ( installation. interpreter ( ) ) ;
1117
+ return Ok ( Ok ( installation) ) ;
1118
+ }
1119
+ // Continue if we can't find a matching Python and ignore non-critical discovery errors
1120
+ Ok ( Err ( _) ) => { }
1121
+ Err ( ref err) if !err. is_critical ( ) => { }
1122
+ _ => return result,
1103
1123
}
1104
1124
}
1105
1125
0 commit comments