mirror of https://github.com/pypa/pip
Merge pull request #8678 from uranusjr/new-resolver-no-deps-extras-install-self
This commit is contained in:
commit
4fa31d509f
|
@ -0,0 +1,2 @@
|
|||
New resolver: Correctly include the base package when specified with extras
|
||||
in ``--no-deps`` mode.
|
|
@ -69,8 +69,8 @@ class Candidate(object):
|
|||
# type: () -> Optional[Link]
|
||||
raise NotImplementedError("Override in subclass")
|
||||
|
||||
def iter_dependencies(self):
|
||||
# type: () -> Iterable[Optional[Requirement]]
|
||||
def iter_dependencies(self, with_requires):
|
||||
# type: (bool) -> Iterable[Optional[Requirement]]
|
||||
raise NotImplementedError("Override in subclass")
|
||||
|
||||
def get_install_requirement(self):
|
||||
|
|
|
@ -273,8 +273,10 @@ class _InstallRequirementBackedCandidate(Candidate):
|
|||
return None
|
||||
return spec
|
||||
|
||||
def iter_dependencies(self):
|
||||
# type: () -> Iterable[Optional[Requirement]]
|
||||
def iter_dependencies(self, with_requires):
|
||||
# type: (bool) -> Iterable[Optional[Requirement]]
|
||||
if not with_requires:
|
||||
return
|
||||
for r in self.dist.requires():
|
||||
yield self._factory.make_requirement_from_spec(str(r), self._ireq)
|
||||
python_dep = self._factory.make_requires_python_requirement(
|
||||
|
@ -418,8 +420,10 @@ class AlreadyInstalledCandidate(Candidate):
|
|||
# type: () -> str
|
||||
return "{} {} (Installed)".format(self.name, self.version)
|
||||
|
||||
def iter_dependencies(self):
|
||||
# type: () -> Iterable[Optional[Requirement]]
|
||||
def iter_dependencies(self, with_requires):
|
||||
# type: (bool) -> Iterable[Optional[Requirement]]
|
||||
if not with_requires:
|
||||
return
|
||||
for r in self.dist.requires():
|
||||
yield self._factory.make_requirement_from_spec(str(r), self._ireq)
|
||||
|
||||
|
@ -517,10 +521,16 @@ class ExtrasCandidate(Candidate):
|
|||
# type: () -> Optional[Link]
|
||||
return self.base.source_link
|
||||
|
||||
def iter_dependencies(self):
|
||||
# type: () -> Iterable[Optional[Requirement]]
|
||||
def iter_dependencies(self, with_requires):
|
||||
# type: (bool) -> Iterable[Optional[Requirement]]
|
||||
factory = self.base._factory
|
||||
|
||||
# Add a dependency on the exact base
|
||||
# (See note 2b in the class docstring)
|
||||
yield factory.make_requirement_from_candidate(self.base)
|
||||
if not with_requires:
|
||||
return
|
||||
|
||||
# The user may have specified extras that the candidate doesn't
|
||||
# support. We ignore any unsupported extras here.
|
||||
valid_extras = self.extras.intersection(self.base.dist.extras)
|
||||
|
@ -533,10 +543,6 @@ 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(
|
||||
str(r), self.base._ireq, valid_extras,
|
||||
|
@ -583,8 +589,8 @@ class RequiresPythonCandidate(Candidate):
|
|||
# type: () -> str
|
||||
return "Python {}".format(self.version)
|
||||
|
||||
def iter_dependencies(self):
|
||||
# type: () -> Iterable[Optional[Requirement]]
|
||||
def iter_dependencies(self, with_requires):
|
||||
# type: (bool) -> Iterable[Optional[Requirement]]
|
||||
return ()
|
||||
|
||||
def get_install_requirement(self):
|
||||
|
|
|
@ -145,6 +145,9 @@ class PipProvider(AbstractProvider):
|
|||
|
||||
def get_dependencies(self, candidate):
|
||||
# type: (Candidate) -> Sequence[Requirement]
|
||||
if self._ignore_dependencies:
|
||||
return []
|
||||
return [r for r in candidate.iter_dependencies() if r is not None]
|
||||
with_requires = not self._ignore_dependencies
|
||||
return [
|
||||
r
|
||||
for r in candidate.iter_dependencies(with_requires)
|
||||
if r is not None
|
||||
]
|
||||
|
|
|
@ -40,3 +40,10 @@ cases:
|
|||
- E 1.0.0
|
||||
- F 1.0.0
|
||||
skip: old
|
||||
-
|
||||
request:
|
||||
- install: D[extra_1]
|
||||
options: --no-deps
|
||||
response:
|
||||
- state:
|
||||
- D 1.0.0
|
||||
|
|
Loading…
Reference in New Issue