Skip to content

Commit 394a24e

Browse files
committed
Upgrade resolvelib to 0.8.0
1 parent 2253ed3 commit 394a24e

File tree

5 files changed

+27
-7
lines changed

5 files changed

+27
-7
lines changed

news/resolvelib.vendor.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Upgrade resolvelib to 0.8.0

src/pip/_vendor/resolvelib/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"ResolutionTooDeep",
1212
]
1313

14-
__version__ = "0.7.1"
14+
__version__ = "0.8.0"
1515

1616

1717
from .providers import AbstractProvider, AbstractResolver

src/pip/_vendor/resolvelib/providers.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,14 @@ def identify(self, requirement_or_candidate):
99
"""
1010
raise NotImplementedError
1111

12-
def get_preference(self, identifier, resolutions, candidates, information):
12+
def get_preference(
13+
self,
14+
identifier,
15+
resolutions,
16+
candidates,
17+
information,
18+
backtrack_causes,
19+
):
1320
"""Produce a sort key for given requirement based on preference.
1421
1522
The preference is defined as "I think this requirement should be
@@ -25,6 +32,8 @@ def get_preference(self, identifier, resolutions, candidates, information):
2532
Each value is an iterator of candidates.
2633
:param information: Mapping of requirement information of each package.
2734
Each value is an iterator of *requirement information*.
35+
:param backtrack_causes: Sequence of requirement information that were
36+
the requirements that caused the resolver to most recently backtrack.
2837
2938
A *requirement information* instance is a named tuple with two members:
3039

src/pip/_vendor/resolvelib/resolvers.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def __init__(self, round_count):
9999

100100

101101
# Resolution state in a round.
102-
State = collections.namedtuple("State", "mapping criteria")
102+
State = collections.namedtuple("State", "mapping criteria backtrack_causes")
103103

104104

105105
class Resolution(object):
@@ -131,6 +131,7 @@ def _push_new_state(self):
131131
state = State(
132132
mapping=base.mapping.copy(),
133133
criteria=base.criteria.copy(),
134+
backtrack_causes=base.backtrack_causes[:],
134135
)
135136
self._states.append(state)
136137

@@ -185,6 +186,7 @@ def _get_preference(self, name):
185186
self.state.criteria,
186187
operator.attrgetter("information"),
187188
),
189+
backtrack_causes=self.state.backtrack_causes,
188190
)
189191

190192
def _is_current_pin_satisfying(self, name, criterion):
@@ -335,7 +337,13 @@ def resolve(self, requirements, max_rounds):
335337
self._r.starting()
336338

337339
# Initialize the root state.
338-
self._states = [State(mapping=collections.OrderedDict(), criteria={})]
340+
self._states = [
341+
State(
342+
mapping=collections.OrderedDict(),
343+
criteria={},
344+
backtrack_causes=[],
345+
)
346+
]
339347
for r in requirements:
340348
try:
341349
self._add_to_criteria(self.state.criteria, r, parent=None)
@@ -369,11 +377,13 @@ def resolve(self, requirements, max_rounds):
369377
# Backtrack if pinning fails. The backtrack process puts us in
370378
# an unpinned state, so we can work on it in the next round.
371379
success = self._backtrack()
380+
self.state.backtrack_causes[:] = [
381+
i for c in failure_causes for i in c.information
382+
]
372383

373384
# Dead ends everywhere. Give up.
374385
if not success:
375-
causes = [i for c in failure_causes for i in c.information]
376-
raise ResolutionImpossible(causes)
386+
raise ResolutionImpossible(self.state.backtrack_causes)
377387
else:
378388
# Pinning was successful. Push a new state to do another pin.
379389
self._push_new_state()

src/pip/_vendor/vendor.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ requests==2.26.0
1414
chardet==4.0.0
1515
idna==3.2
1616
urllib3==1.26.7
17-
resolvelib==0.7.1
17+
resolvelib==0.8.0
1818
setuptools==44.0.0
1919
six==1.16.0
2020
tenacity==8.0.1

0 commit comments

Comments
 (0)