Skip to content

Commit

Permalink
Upgrade resolvelib>=0.8.1,<0.9.0
Browse files Browse the repository at this point in the history
Since 2021-09-27 `resolvelib` author comment with "issue resolved now"
(see sarugaku/resolvelib#69 (comment)).

Replace `resolvelib` version upper cap with `resolvelib>=0.8.1,<0.9.0`
with corresponding `find_matches()` and `get_preference()` interface
change should now be good enough.

Signed-off-by: Wong Hoi Sing Edison <[email protected]>
  • Loading branch information
hswong3i committed May 18, 2022
1 parent 185340e commit 267a11d
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 11 deletions.
18 changes: 13 additions & 5 deletions lib/ansible/galaxy/dependency_resolution/providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,11 @@ def identify(self, requirement_or_candidate):

def get_preference(
self, # type: CollectionDependencyProvider
resolution, # type: t.Optional[Candidate]
candidates, # type: list[Candidate]
information, # type: list[t.NamedTuple]
identifier, # type: str
resolutions, # type: t.Mapping[str, Candidate]
candidates, # type: t.Mapping[str, t.Iterator[Candidate]]
information, # type: t.Mapping[str, t.Iterable[t.NamedTuple]]
backtrack_causes, # type: t.Sequence
): # type: (...) -> t.Union[float, int]
"""Return sort key function return value for given requirement.
Expand Down Expand Up @@ -215,6 +217,7 @@ def get_preference(
the value is, the more preferred this requirement is (i.e. the
sorting function is called with ``reverse=False``).
"""
candidates = list(candidates[identifier])
if any(
candidate in self._preferred_candidates
for candidate in candidates
Expand All @@ -224,8 +227,12 @@ def get_preference(
return float('-inf')
return len(candidates)

def find_matches(self, requirements):
# type: (list[Requirement]) -> list[Candidate]
def find_matches(
self, # type: CollectionDependencyProvider
identifier, # type: str
requirements, # type: t.Mapping[str, t.Iterator[Requirement]]
incompatibilities # type: t.Mapping[str, t.Iterator[Candidate]]
): # type: (...) -> t.List[Candidate]
r"""Find all possible candidates satisfying given requirements.
This tries to get candidates based on the requirements' types.
Expand All @@ -250,6 +257,7 @@ def find_matches(self, requirements):
# FIXME: its cloned tmp dir. Using only the first one creates
# FIXME: loops that prevent any further dependency exploration.
# FIXME: We need to figure out how to prevent this.
requirements = list(requirements[identifier])
first_req = requirements[0]
fqcn = first_req.fqcn
# The fqcn is guaranteed to be the same
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ packaging
# NOTE: resolvelib 0.x version bumps should be considered major/breaking
# NOTE: and we should update the upper cap with care, at least until 1.0
# NOTE: Ref: https://github.com/sarugaku/resolvelib/issues/69
resolvelib >= 0.5.3, < 0.6.0 # dependency resolver used by ansible-galaxy
resolvelib >= 0.8.1, < 0.9.0 # dependency resolver used by ansible-galaxy
2 changes: 1 addition & 1 deletion test/lib/ansible_test/_data/requirements/ansible.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ packaging
# NOTE: resolvelib 0.x version bumps should be considered major/breaking
# NOTE: and we should update the upper cap with care, at least until 1.0
# NOTE: Ref: https://github.com/sarugaku/resolvelib/issues/69
resolvelib >= 0.5.3, < 0.6.0 # dependency resolver used by ansible-galaxy
resolvelib >= 0.8.1, < 0.9.0 # dependency resolver used by ansible-galaxy
2 changes: 1 addition & 1 deletion test/sanity/code-smell/docs-build.requirements.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
jinja2
pyyaml
resolvelib < 0.6.0
resolvelib >= 0.8.1, < 0.9.0
sphinx == 4.2.0
sphinx-notfound-page
sphinx-ansible-theme
Expand Down
2 changes: 1 addition & 1 deletion test/sanity/code-smell/docs-build.requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pyparsing==2.4.7
pytz==2021.3
PyYAML==6.0
requests==2.26.0
resolvelib==0.5.4
resolvelib==0.8.1
rstcheck==3.3.1
semantic-version==2.8.5
sh==1.14.2
Expand Down
2 changes: 1 addition & 1 deletion test/sanity/code-smell/package-data.requirements.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
docutils < 0.18 # match version required by sphinx in the docs-build sanity test
jinja2
pyyaml # ansible-core requirement
resolvelib < 0.6.0
resolvelib >= 0.8.1, < 0.9.0
rstcheck
straight.plugin
antsibull-changelog
2 changes: 1 addition & 1 deletion test/sanity/code-smell/package-data.requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ MarkupSafe==2.0.1
packaging==21.2
pyparsing==2.4.7
PyYAML==6.0
resolvelib==0.5.4
resolvelib==0.8.1
rstcheck==3.3.1
semantic-version==2.8.5
straight.plugin==1.5.0

0 comments on commit 267a11d

Please sign in to comment.