1
1
use crate :: resolvo:: { CondaDependencyProvider , SolverMatchSpec } ;
2
+ use futures:: future:: FutureExt ;
2
3
use rattler_conda_types:: Version ;
3
4
use resolvo:: { Dependencies , SolvableId , SolverCache , VersionSetId } ;
4
5
use std:: cmp:: Ordering ;
5
6
use std:: collections:: HashMap ;
6
-
7
7
/// Returns the order of two candidates based on the order used by conda.
8
8
#[ allow( clippy:: too_many_arguments) ]
9
9
pub ( super ) fn compare_candidates < ' a > (
@@ -47,11 +47,19 @@ pub(super) fn compare_candidates<'a>(
47
47
Ordering :: Equal => { }
48
48
} ;
49
49
50
+ // return Ordering::Equal;
51
+
50
52
// Otherwise, compare the dependencies of the variants. If there are similar
51
53
// dependencies select the variant that selects the highest version of the dependency.
52
54
let ( a_dependencies, b_dependencies) = match (
53
- solver. get_or_cache_dependencies ( a) ,
54
- solver. get_or_cache_dependencies ( b) ,
55
+ solver
56
+ . get_or_cache_dependencies ( a)
57
+ . now_or_never ( )
58
+ . expect ( "get_or_cache_dependencies failed" ) ,
59
+ solver
60
+ . get_or_cache_dependencies ( b)
61
+ . now_or_never ( )
62
+ . expect ( "get_or_cache_dependencies failed" ) ,
55
63
) {
56
64
( Ok ( a_deps) , Ok ( b_deps) ) => ( a_deps, b_deps) ,
57
65
// If either call fails, it's likely due to solver cancellation; thus, we can't compare dependencies
@@ -147,7 +155,10 @@ pub(super) fn find_highest_version<'a>(
147
155
match_spec_highest_version
148
156
. entry ( match_spec_id)
149
157
. or_insert_with ( || {
150
- let candidates = solver. get_or_cache_matching_candidates ( match_spec_id) ;
158
+ let candidates = solver
159
+ . get_or_cache_matching_candidates ( match_spec_id)
160
+ . now_or_never ( )
161
+ . expect ( "get_or_cache_matching_candidates failed" ) ;
151
162
152
163
// Err only happens on cancellation, so we will not continue anyways
153
164
let candidates = if let Ok ( candidates) = candidates {
@@ -156,9 +167,11 @@ pub(super) fn find_highest_version<'a>(
156
167
return None ;
157
168
} ;
158
169
170
+ let pool = solver. pool ( ) ;
171
+
159
172
candidates
160
173
. iter ( )
161
- . map ( |id| solver . pool ( ) . resolve_solvable ( * id) . inner ( ) )
174
+ . map ( |id| pool. resolve_solvable ( * id) . inner ( ) )
162
175
. fold ( None , |init, record| {
163
176
Some ( init. map_or_else (
164
177
|| {
0 commit comments