Skip to content

Commit

Permalink
Stop passing finder to DistAbstraction.dist
Browse files Browse the repository at this point in the history
  • Loading branch information
pradyunsg committed Jan 2, 2019
1 parent 71b6e95 commit f9b66ca
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
5 changes: 1 addition & 4 deletions src/pip/_internal/operations/check.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,6 @@ def check_install_conflicts(to_install):
)


# NOTE from @pradyunsg
# This required a minor update in dependency link handling logic over at
# operations.prepare.IsSDist.dist() to get it working
def _simulate_installation_of(to_install, package_set):
# type: (List[InstallRequirement], PackageSet) -> Set[str]
"""Computes the version of packages after installing to_install.
Expand All @@ -133,7 +130,7 @@ def _simulate_installation_of(to_install, package_set):

# Modify it as installing requirement_set would (assuming no errors)
for inst_req in to_install:
dist = make_abstract_dist(inst_req).dist(finder=None)
dist = make_abstract_dist(inst_req).dist()
name = canonicalize_name(dist.key)
package_set[name] = PackageDetails(dist.version, dist.requires())

Expand Down
15 changes: 7 additions & 8 deletions src/pip/_internal/operations/prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ def __init__(self, req):
# type: (InstallRequirement) -> None
self.req = req # type: InstallRequirement

def dist(self, finder):
# type: (PackageFinder) -> Any
def dist(self):
# type: () -> Any
"""Return a setuptools Dist object."""
raise NotImplementedError(self.dist)

Expand All @@ -84,8 +84,8 @@ def prep_for_dist(self, finder, build_isolation):

class IsWheel(DistAbstraction):

def dist(self, finder):
# type: (PackageFinder) -> pkg_resources.Distribution
def dist(self):
# type: () -> pkg_resources.Distribution
return list(pkg_resources.find_distributions(
self.req.source_dir))[0]

Expand All @@ -97,8 +97,7 @@ def prep_for_dist(self, finder, build_isolation):

class IsSDist(DistAbstraction):

# TODO: Remove 'finder' and the note in operations/check.py
def dist(self, finder):
def dist(self):
return self.req.get_dist()

def prep_for_dist(self, finder, build_isolation):
Expand Down Expand Up @@ -162,8 +161,8 @@ def _raise_conflicts(conflicting_with, conflicting_reqs):

class Installed(DistAbstraction):

def dist(self, finder):
# type: (PackageFinder) -> pkg_resources.Distribution
def dist(self):
# type: () -> pkg_resources.Distribution
return self.req.satisfied_by

def prep_for_dist(self, finder, build_isolation):
Expand Down
2 changes: 1 addition & 1 deletion src/pip/_internal/resolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def _resolve_one(
abstract_dist = self._get_abstract_dist_for(req_to_install)

# Parse and return dependencies
dist = abstract_dist.dist(self.finder)
dist = abstract_dist.dist()
try:
check_dist_requires_python(dist)
except UnsupportedPythonVersion as err:
Expand Down

0 comments on commit f9b66ca

Please sign in to comment.