@@ -223,7 +223,7 @@ def evaluate_link(self, link: Link) -> Tuple[bool, Optional[str]]:
223
223
ignore_requires_python = self ._ignore_requires_python ,
224
224
)
225
225
if not supports_python :
226
- reason = f'{ version } requires-python { link .requires_python } '
226
+ reason = f'{ version } Requires-Python { link .requires_python } '
227
227
return (False , reason )
228
228
229
229
logger .debug ("Found link %s, version: %s" , link , version )
@@ -608,8 +608,7 @@ def __init__(
608
608
self .format_control = format_control
609
609
610
610
# These are boring links that have already been logged somehow.
611
- self ._logged_links = set () # type: Set[Link]
612
- self ._logged_links_rp = set () # type: Set[str]
611
+ self ._logged_links = set () # type: Set[Tuple[Link, str]]
613
612
614
613
# Don't include an allow_yanked default value to make sure each call
615
614
# site considers whether yanked releases are allowed. This also causes
@@ -699,6 +698,14 @@ def make_link_evaluator(self, project_name: str) -> LinkEvaluator:
699
698
ignore_requires_python = self ._ignore_requires_python ,
700
699
)
701
700
701
+ def skipped_links_requires_python (self ):
702
+ # type: () -> List[str]
703
+ skips = [skip [1 ] for skip in self ._logged_links if 'Requires-Python' in skip [1 ]]
704
+ # cleans duplicate package version found from different links
705
+ skips = list (dict .fromkeys (skips ))
706
+ skips .sort ()
707
+ return skips
708
+
702
709
def logged_links_rp (self ):
703
710
# type: () -> List[str]
704
711
skips = [skip for skip in self ._logged_links_rp ]
@@ -722,11 +729,11 @@ def _sort_links(self, links: Iterable[Link]) -> List[Link]:
722
729
return no_eggs + eggs
723
730
724
731
def _log_skipped_link (self , link : Link , reason : str ) -> None :
725
- if link not in self ._logged_links :
732
+ if ( link , reason ) not in self ._logged_links :
726
733
# Put the link at the end so the reason is more visible and because
727
734
# the link string is usually very long.
728
- logger .debug (" Skipping link: %s: %s" , reason , link )
729
- self ._logged_links .add (link )
735
+ logger .debug (' Skipping link: %s: %s' , reason , link )
736
+ self ._logged_links .add (( link , reason ) )
730
737
731
738
def get_install_candidate (
732
739
self , link_evaluator : LinkEvaluator , link : Link
@@ -737,10 +744,7 @@ def get_install_candidate(
737
744
"""
738
745
is_candidate , result = link_evaluator .evaluate_link (link )
739
746
if not is_candidate :
740
- if 'requires-python' in result :
741
- self ._log_skipped_link_rp (result )
742
- else :
743
- self ._log_skipped_link (link , reason = result )
747
+ self ._log_skipped_link (link , result )
744
748
return None
745
749
746
750
return InstallationCandidate (
0 commit comments