File tree Expand file tree Collapse file tree 2 files changed +17
-12
lines changed
src/pip/_internal/resolution/resolvelib Expand file tree Collapse file tree 2 files changed +17
-12
lines changed Original file line number Diff line number Diff line change 46
46
from pip ._internal .resolution .base import InstallRequirementProvider
47
47
from pip ._internal .utils .compatibility_tags import get_supported
48
48
from pip ._internal .utils .hashes import Hashes
49
+ from pip ._internal .utils .parallel import LACK_SEM_OPEN , map_multithread
49
50
from pip ._internal .utils .virtualenv import running_under_virtualenv
50
51
51
52
from .base import Candidate , CandidateVersion , Constraint , Requirement
@@ -344,6 +345,21 @@ def _iter_candidates_from_constraints(
344
345
if candidate :
345
346
yield candidate
346
347
348
+ def pre_find_all (self , project_names : Iterator [str ]) -> None :
349
+ if LACK_SEM_OPEN :
350
+ return
351
+ if not hasattr (self ._finder .find_all_candidates , "cache_info" ):
352
+ return
353
+
354
+ def _maybe_find_candidates (project_name : str ) -> None :
355
+ try :
356
+ self ._finder .find_all_candidates (project_name )
357
+ except AttributeError :
358
+ pass
359
+
360
+ for _ in map_multithread (_maybe_find_candidates , project_names ):
361
+ pass
362
+
347
363
def find_candidates (
348
364
self ,
349
365
identifier : str ,
Original file line number Diff line number Diff line change 21
21
)
22
22
from pip ._internal .utils .deprecation import deprecated
23
23
from pip ._internal .utils .filetypes import is_archive_file
24
- from pip ._internal .utils .parallel import LACK_SEM_OPEN , map_multithread
25
24
26
25
from .base import Candidate , Requirement
27
26
from .factory import Factory
@@ -90,17 +89,7 @@ def resolve(
90
89
reporter ,
91
90
)
92
91
93
- if LACK_SEM_OPEN is False :
94
-
95
- def _maybe_find_candidates (req : Requirement ) -> None :
96
- ident = provider .identify (req )
97
- try :
98
- self .factory ._finder .find_all_candidates (ident )
99
- except AttributeError :
100
- pass
101
-
102
- for _ in map_multithread (_maybe_find_candidates , collected .requirements ):
103
- pass
92
+ self .factory .pre_find_all (provider .identify (r ) for r in collected .requirements )
104
93
105
94
try :
106
95
try_to_avoid_resolution_too_deep = 2000000
You can’t perform that action at this time.
0 commit comments