mirror of
https://github.com/pypa/pip
synced 2023-12-13 21:30:23 +01:00
Merge pull request #8291 from pradyunsg/direct-url-with-extras
New Resolver: Add support for direct URLs with extras
This commit is contained in:
commit
50247de9ab
3 changed files with 13 additions and 14 deletions
|
@ -347,8 +347,8 @@ class ExtrasCandidate(Candidate):
|
|||
to treat it as a separate node in the dependency graph.
|
||||
2. When we're getting the candidate's dependencies,
|
||||
a) We specify that we want the extra dependencies as well.
|
||||
b) We add a dependency on the base candidate (matching the name and
|
||||
version). See below for why this is needed.
|
||||
b) We add a dependency on the base candidate.
|
||||
See below for why this is needed.
|
||||
3. We return None for the underlying InstallRequirement, as the base
|
||||
candidate will provide it, and we don't want to end up with duplicates.
|
||||
|
||||
|
@ -417,6 +417,10 @@ class ExtrasCandidate(Candidate):
|
|||
extra
|
||||
)
|
||||
|
||||
# Add a dependency on the exact base
|
||||
# (See note 2b in the class docstring)
|
||||
yield factory.make_requirement_from_candidate(self.base)
|
||||
|
||||
for r in self.base.dist.requires(valid_extras):
|
||||
requirement = factory.make_requirement_from_spec_matching_extras(
|
||||
str(r), self.base._ireq, valid_extras,
|
||||
|
@ -424,13 +428,6 @@ class ExtrasCandidate(Candidate):
|
|||
if requirement:
|
||||
yield requirement
|
||||
|
||||
# Add a dependency on the exact base.
|
||||
# (See note 2b in the class docstring)
|
||||
# FIXME: This does not work if the base candidate is specified by
|
||||
# link, e.g. "pip install .[dev]" will fail.
|
||||
spec = "{}=={}".format(self.base.name, self.base.version)
|
||||
yield factory.make_requirement_from_spec(spec, self.base._ireq)
|
||||
|
||||
def get_install_requirement(self):
|
||||
# type: () -> Optional[InstallRequirement]
|
||||
# We don't return anything here, because we always
|
||||
|
|
|
@ -180,12 +180,16 @@ class Factory(object):
|
|||
# TODO: Get name and version from ireq, if possible?
|
||||
# Specifically, this might be needed in "name @ URL"
|
||||
# syntax - need to check where that syntax is handled.
|
||||
cand = self._make_candidate_from_link(
|
||||
candidate = self._make_candidate_from_link(
|
||||
ireq.link, extras=set(ireq.extras), parent=ireq,
|
||||
)
|
||||
return ExplicitRequirement(cand)
|
||||
return self.make_requirement_from_candidate(candidate)
|
||||
return SpecifierRequirement(ireq, factory=self)
|
||||
|
||||
def make_requirement_from_candidate(self, candidate):
|
||||
# type: (Candidate) -> ExplicitRequirement
|
||||
return ExplicitRequirement(candidate)
|
||||
|
||||
def make_requirement_from_spec(self, specifier, comes_from):
|
||||
# type: (str, InstallRequirement) -> Requirement
|
||||
ireq = self._make_install_req_from_spec(specifier, comes_from)
|
||||
|
|
|
@ -825,9 +825,7 @@ class TestExtraMerge(object):
|
|||
@pytest.mark.parametrize(
|
||||
"pkg_builder",
|
||||
[
|
||||
pytest.param(
|
||||
_local_with_setup, marks=pytest.mark.xfail(strict=True),
|
||||
),
|
||||
_local_with_setup,
|
||||
_direct_wheel,
|
||||
_wheel_from_index,
|
||||
],
|
||||
|
|
Loading…
Reference in a new issue