Closed
Description
Spawned from #8209.
According to test_install_distribution_union_with_constraints
, this is a valid constraint:
C:\Temp\packages\foo[bar]
This is quite difficult to deal with. We can store the constraint information in a separate mapping (with the URL as key), but I’m not sure how it can be fetched. Here’s how we get the relevant constraint to use:
def find_matches(self, requirement):
# type: (Requirement) -> Sequence[Candidate]
constraint = self._constraints.get(requirement.name, SpecifierSet())
return requirement.find_matches(constraint)
I guess we can do something like:
def find_matches(self, requirement):
# type: (Requirement) -> Sequence[Candidate]
constraint = self._constraints.get(requirement.name, SpecifierSet())
if isinstance(requirement, ExplicitRequirement) and
isinstance(requirement.candidate, (LinkCandidate, EditableCandidate)):
constraint &= self._url_constraints.get(
requirement.candidate.link.url, SpecifierSet(),
)
return requirement.find_matches(constraint)
but we probably can agree this looks super wrong. Some additional abstraction is needed here.