@@ -371,6 +371,10 @@ impl PrioritizedDist {
371
371
self . 0 . markers . or ( implied_markers ( & dist. filename ) ) ;
372
372
}
373
373
}
374
+ // Track the hashes.
375
+ if !compatibility. is_excluded ( ) {
376
+ self . 0 . hashes . extend ( hashes) ;
377
+ }
374
378
// Track the highest-priority wheel.
375
379
if let Some ( ( .., existing_compatibility) ) = self . best_wheel ( ) {
376
380
if compatibility. is_more_compatible ( existing_compatibility) {
@@ -379,7 +383,6 @@ impl PrioritizedDist {
379
383
} else {
380
384
self . 0 . best_wheel_index = Some ( self . 0 . wheels . len ( ) ) ;
381
385
}
382
- self . 0 . hashes . extend ( hashes) ;
383
386
self . 0 . wheels . push ( ( dist, compatibility) ) ;
384
387
}
385
388
@@ -394,6 +397,10 @@ impl PrioritizedDist {
394
397
if compatibility. is_compatible ( ) {
395
398
self . 0 . markers = MarkerTree :: TRUE ;
396
399
}
400
+ // Track the hashes.
401
+ if !compatibility. is_excluded ( ) {
402
+ self . 0 . hashes . extend ( hashes) ;
403
+ }
397
404
// Track the highest-priority source.
398
405
if let Some ( ( .., existing_compatibility) ) = & self . 0 . source {
399
406
if compatibility. is_more_compatible ( existing_compatibility) {
@@ -402,7 +409,6 @@ impl PrioritizedDist {
402
409
} else {
403
410
self . 0 . source = Some ( ( dist, compatibility) ) ;
404
411
}
405
- self . 0 . hashes . extend ( hashes) ;
406
412
}
407
413
408
414
/// Return the highest-priority distribution for the package version, if any.
@@ -501,6 +507,7 @@ impl PrioritizedDist {
501
507
. 0
502
508
. wheels
503
509
. iter ( )
510
+ . filter ( |( _, compatibility) | !compatibility. is_excluded ( ) )
504
511
. map ( |( wheel, _) | wheel. clone ( ) )
505
512
. collect ( ) ;
506
513
let sdist = self . 0 . source . as_ref ( ) . map ( |( sdist, _) | sdist. clone ( ) ) ;
@@ -514,7 +521,12 @@ impl PrioritizedDist {
514
521
/// If this prioritized dist has an sdist, then this creates a source
515
522
/// distribution.
516
523
pub fn source_dist ( & self ) -> Option < RegistrySourceDist > {
517
- let mut sdist = self . 0 . source . as_ref ( ) . map ( |( sdist, _) | sdist. clone ( ) ) ?;
524
+ let mut sdist = self
525
+ . 0
526
+ . source
527
+ . as_ref ( )
528
+ . filter ( |( _, compatibility) | !compatibility. is_excluded ( ) )
529
+ . map ( |( sdist, _) | sdist. clone ( ) ) ?;
518
530
assert ! (
519
531
sdist. wheels. is_empty( ) ,
520
532
"source distribution should not have any wheels yet"
@@ -623,6 +635,11 @@ impl WheelCompatibility {
623
635
matches ! ( self , Self :: Compatible ( _, _, _) )
624
636
}
625
637
638
+ /// Return `true` if the distribution is excluded.
639
+ pub fn is_excluded ( & self ) -> bool {
640
+ matches ! ( self , Self :: Incompatible ( IncompatibleWheel :: ExcludeNewer ( _) ) )
641
+ }
642
+
626
643
/// Return `true` if the current compatibility is more compatible than another.
627
644
///
628
645
/// Compatible wheels are always higher more compatible than incompatible wheels.
@@ -650,6 +667,14 @@ impl SourceDistCompatibility {
650
667
matches ! ( self , Self :: Compatible ( _) )
651
668
}
652
669
670
+ /// Return `true` if the distribution is excluded.
671
+ pub fn is_excluded ( & self ) -> bool {
672
+ matches ! (
673
+ self ,
674
+ Self :: Incompatible ( IncompatibleSource :: ExcludeNewer ( _) )
675
+ )
676
+ }
677
+
653
678
/// Return the higher priority compatibility.
654
679
///
655
680
/// Compatible source distributions are always higher priority than incompatible source distributions.
0 commit comments