1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00

Remove now-unused finder and format_control from WheelBuilder.

This commit is contained in:
Chris Hunt 2019-09-04 21:10:34 -04:00
parent a4102d179a
commit b63ea9cd08
4 changed files with 4 additions and 18 deletions

View file

@ -393,7 +393,7 @@ class InstallCommand(RequirementCommand):
legacy_requirements.append(req) legacy_requirements.append(req)
wheel_builder = WheelBuilder( wheel_builder = WheelBuilder(
finder, preparer, wheel_cache, preparer, wheel_cache,
build_options=[], global_options=[], build_options=[], global_options=[],
check_binary_allowed=check_binary_allowed, check_binary_allowed=check_binary_allowed,
) )

View file

@ -154,7 +154,7 @@ class WheelCommand(RequirementCommand):
# build wheels # build wheels
wb = WheelBuilder( wb = WheelBuilder(
finder, preparer, wheel_cache, preparer, wheel_cache,
build_options=options.build_options or [], build_options=options.build_options or [],
global_options=options.global_options or [], global_options=options.global_options or [],
no_clean=options.no_clean, no_clean=options.no_clean,

View file

@ -58,7 +58,6 @@ if MYPY_CHECK_RUNNING:
) )
from pip._vendor.packaging.requirements import Requirement from pip._vendor.packaging.requirements import Requirement
from pip._internal.req.req_install import InstallRequirement from pip._internal.req.req_install import InstallRequirement
from pip._internal.index import FormatControl, PackageFinder
from pip._internal.operations.prepare import ( from pip._internal.operations.prepare import (
RequirementPreparer RequirementPreparer
) )
@ -778,7 +777,6 @@ def _contains_egg_info(
def should_use_ephemeral_cache( def should_use_ephemeral_cache(
req, # type: InstallRequirement req, # type: InstallRequirement
format_control, # type: FormatControl
should_unpack, # type: bool should_unpack, # type: bool
cache_available, # type: bool cache_available, # type: bool
check_binary_allowed, # type: BinaryAllowedPredicate check_binary_allowed, # type: BinaryAllowedPredicate
@ -899,7 +897,6 @@ class WheelBuilder(object):
def __init__( def __init__(
self, self,
finder, # type: PackageFinder
preparer, # type: RequirementPreparer preparer, # type: RequirementPreparer
wheel_cache, # type: WheelCache wheel_cache, # type: WheelCache
build_options=None, # type: Optional[List[str]] build_options=None, # type: Optional[List[str]]
@ -908,7 +905,6 @@ class WheelBuilder(object):
no_clean=False # type: bool no_clean=False # type: bool
): ):
# type: (...) -> None # type: (...) -> None
self.finder = finder
if check_binary_allowed is None: if check_binary_allowed is None:
# Binaries allowed by default. # Binaries allowed by default.
check_binary_allowed = _always_true check_binary_allowed = _always_true
@ -1071,13 +1067,11 @@ class WheelBuilder(object):
) )
buildset = [] buildset = []
format_control = self.finder.format_control
cache_available = bool(self.wheel_cache.cache_dir) cache_available = bool(self.wheel_cache.cache_dir)
for req in requirements: for req in requirements:
ephem_cache = should_use_ephemeral_cache( ephem_cache = should_use_ephemeral_cache(
req, req,
format_control=format_control,
should_unpack=should_unpack, should_unpack=should_unpack,
cache_available=cache_available, cache_available=cache_available,
check_binary_allowed=self.check_binary_allowed, check_binary_allowed=self.check_binary_allowed,

View file

@ -10,7 +10,6 @@ from pip._vendor.packaging.requirements import Requirement
from pip._internal import pep425tags, wheel from pip._internal import pep425tags, wheel
from pip._internal.exceptions import InvalidWheelFilename, UnsupportedWheel from pip._internal.exceptions import InvalidWheelFilename, UnsupportedWheel
from pip._internal.index import FormatControl
from pip._internal.models.link import Link from pip._internal.models.link import Link
from pip._internal.req.req_install import InstallRequirement from pip._internal.req.req_install import InstallRequirement
from pip._internal.utils.compat import WINDOWS from pip._internal.utils.compat import WINDOWS
@ -100,12 +99,10 @@ def test_should_use_ephemeral_cache__issue_6197(
assert not req.is_wheel assert not req.is_wheel
assert req.link.is_artifact assert req.link.is_artifact
format_control = FormatControl()
always_true = Mock(return_value=True) always_true = Mock(return_value=True)
ephem_cache = wheel.should_use_ephemeral_cache( ephem_cache = wheel.should_use_ephemeral_cache(
req, format_control=format_control, should_unpack=should_unpack, req, should_unpack=should_unpack,
cache_available=cache_available, check_binary_allowed=always_true, cache_available=cache_available, check_binary_allowed=always_true,
) )
assert ephem_cache is expected assert ephem_cache is expected
@ -141,15 +138,11 @@ def test_should_use_ephemeral_cache__disallow_binaries_and_vcs_checkout(
assert not req.is_wheel assert not req.is_wheel
assert req.link.is_vcs assert req.link.is_vcs
format_control = FormatControl()
if disallow_binaries:
format_control.disallow_binaries()
check_binary_allowed = Mock(return_value=not disallow_binaries) check_binary_allowed = Mock(return_value=not disallow_binaries)
# The cache_available value doesn't matter for this test. # The cache_available value doesn't matter for this test.
ephem_cache = wheel.should_use_ephemeral_cache( ephem_cache = wheel.should_use_ephemeral_cache(
req, format_control=format_control, should_unpack=True, req, should_unpack=True,
cache_available=True, check_binary_allowed=check_binary_allowed, cache_available=True, check_binary_allowed=check_binary_allowed,
) )
assert ephem_cache is expected assert ephem_cache is expected
@ -701,7 +694,6 @@ class TestWheelBuilder(object):
as mock_build_one: as mock_build_one:
wheel_req = Mock(is_wheel=True, editable=False, constraint=False) wheel_req = Mock(is_wheel=True, editable=False, constraint=False)
wb = wheel.WheelBuilder( wb = wheel.WheelBuilder(
finder=Mock(),
preparer=Mock(), preparer=Mock(),
wheel_cache=Mock(cache_dir=None), wheel_cache=Mock(cache_dir=None),
) )