@@ -909,7 +909,7 @@ def _find_all_candidates_static(
909
909
link_evaluator_tuple , # type: LinkEvaluatorTuple
910
910
project_name # type: str
911
911
):
912
- # type: (...) -> List[InstallationCandidate]
912
+ # type: (...) -> Tuple[ List[InstallationCandidate], Set[Link] ]
913
913
"""Find all available InstallationCandidate for project_name
914
914
915
915
This checks index_urls and find_links.
@@ -919,15 +919,13 @@ def _find_all_candidates_static(
919
919
are accepted.
920
920
"""
921
921
922
- # Need to convert logged_links to normal set, so we can update it.
923
922
package_finder_tuple = PackageFinderTuple (
924
923
logged_links = set (package_finder_tuple .logged_links ),
925
924
link_collector = package_finder_tuple .link_collector ,
926
925
target_python = package_finder_tuple .target_python ,
927
926
candidate_prefs = package_finder_tuple .candidate_prefs
928
927
)
929
928
930
- # Add link_collector to the tuple
931
929
collected_links = package_finder_tuple .link_collector .collect_links (
932
930
project_name
933
931
)
@@ -938,7 +936,6 @@ def _find_all_candidates_static(
938
936
links = collected_links .find_links ,
939
937
)
940
938
941
- # Only needs link collector from package_finder
942
939
page_versions = []
943
940
for project_url in collected_links .project_urls :
944
941
package_links = PackageFinder ._process_project_url_static (
@@ -964,7 +961,10 @@ def _find_all_candidates_static(
964
961
)
965
962
966
963
# This is an intentional priority ordering
967
- return file_versions + find_links_versions + page_versions
964
+ return (
965
+ file_versions + find_links_versions + page_versions ,
966
+ package_finder_tuple .logged_links
967
+ )
968
968
969
969
def find_all_candidates (self , project_name ):
970
970
# type: (str) -> List[InstallationCandidate]
@@ -980,12 +980,17 @@ def find_all_candidates(self, project_name):
980
980
981
981
package_finder_tuple = self .get_state_as_tuple (immutable = True )
982
982
link_evaluator_tuple = link_evaluator .get_state_as_tuple ()
983
- return self ._find_all_candidates_static (
983
+
984
+ (candidates , logged_links ) = self ._find_all_candidates_static (
984
985
package_finder_tuple ,
985
986
link_evaluator_tuple ,
986
987
project_name
987
988
)
988
989
990
+ self ._logged_links = logged_links
991
+
992
+ return candidates
993
+
989
994
@staticmethod
990
995
def _make_candidate_evaluator_static (
991
996
package_finder_tuple , # type: PackageFinderTuple
@@ -1030,20 +1035,20 @@ def _find_best_candidate_static(
1030
1035
specifier = None , # type: Optional[specifiers.BaseSpecifier]
1031
1036
hashes = None # type: Optional[Hashes]
1032
1037
):
1033
- # type: (...) -> BestCandidateResult
1038
+ # type: (...) -> Tuple[ BestCandidateResult, Set[Link]]
1034
1039
candidate_evaluator = PackageFinder ._make_candidate_evaluator_static (
1035
1040
package_finder_tuple ,
1036
1041
project_name ,
1037
1042
specifier ,
1038
1043
hashes
1039
1044
)
1040
- candidates = PackageFinder ._find_all_candidates_static (
1045
+ ( candidates , logged_links ) = PackageFinder ._find_all_candidates_static (
1041
1046
package_finder_tuple ,
1042
1047
link_evaluator_tuple ,
1043
1048
project_name
1044
1049
)
1045
1050
1046
- return candidate_evaluator .compute_best_candidate (candidates )
1051
+ return ( candidate_evaluator .compute_best_candidate (candidates ), logged_links )
1047
1052
1048
1053
def find_best_candidate (
1049
1054
self ,
@@ -1066,14 +1071,18 @@ def find_best_candidate(
1066
1071
package_finder_tuple = self .get_state_as_tuple (immutable = True )
1067
1072
link_evaluator_tuple = link_evaluator .get_state_as_tuple ()
1068
1073
1069
- return self ._find_best_candidate_static (
1074
+ ( best_candidate , logged_links ) = self ._find_best_candidate_static (
1070
1075
package_finder_tuple ,
1071
1076
link_evaluator_tuple ,
1072
1077
project_name ,
1073
1078
specifier ,
1074
1079
hashes
1075
1080
)
1076
1081
1082
+ self ._logged_links = logged_links
1083
+
1084
+ return best_candidate
1085
+
1077
1086
def find_requirement (self , req , upgrade ):
1078
1087
# type: (InstallRequirement, bool) -> Optional[InstallationCandidate]
1079
1088
"""Try to find a Link matching req
0 commit comments