Skip to content

Commit 656a8c0

Browse files
committed
resolver.py: Fix is_satisfied_by()
is_satisfied_by() returns false if a requirement is defined without a specifier. For example using 'aotriton' (no other arguments) results in a failure regardless of any constraint specified. In this case it is safe to return True and return a tested value for the constraint. Fix is_satisfied_by() to handle requirements without specifiers. Signed-off-by: Prarit Bhargava <[email protected]>
1 parent 92c7bc0 commit 656a8c0

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/fromager/resolver.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -320,9 +320,14 @@ def is_satisfied_by(self, requirement: Requirement, candidate: Candidate) -> boo
320320
allow_prerelease = self.constraints.allow_prerelease(requirement.name) or bool(
321321
requirement.specifier.prereleases
322322
)
323-
return requirement.specifier.contains(
324-
candidate.version, prereleases=allow_prerelease
325-
) and self.constraints.is_satisfied_by(requirement.name, candidate.version)
323+
reqbool = True
324+
if len(requirement.specifier) == 1:
325+
reqbool = requirement.specifier.contains(
326+
candidate.version, prereleases=allow_prerelease
327+
)
328+
return reqbool and self.constraints.is_satisfied_by(
329+
requirement.name, candidate.version
330+
)
326331

327332
def get_dependencies(self, candidate: Candidate) -> list[Requirement]:
328333
# return candidate.dependencies

0 commit comments

Comments
 (0)