summaryrefslogtreecommitdiff
path: root/src/pip/_internal/wheel_builder.py
diff options
context:
space:
mode:
authorStéphane Bidoul (ACSONE) <stephane.bidoul@acsone.eu>2020-01-12 14:20:58 +0100
committerXavier Fernandez <xav.fernandez@gmail.com>2020-01-20 10:41:48 +0100
commit0e1e0ef5662cae83fa5596bb5bc8386f395dd756 (patch)
treed7147ab481811719ce21c56ca5b8f2545ebe9777 /src/pip/_internal/wheel_builder.py
parentc55eee4188638a861a8a12413e78e4ae763718fd (diff)
downloadpip-0e1e0ef5662cae83fa5596bb5bc8386f395dd756.tar.gz
_should_cache does not depend on check_binary_allowed
_should_cache is only called by _get_cache_dir. In pip install mode, _get_cache_dir is never called when check_binary_allowed returns False because in that case should_build_for_install_command has returned False before and the build was skipped. In pip wheel mode, check_binary_allowed always returns True (because it is not passed to the build function). So _should_cache can use _always_true for check_binary_allowed. *Alternative* Alternatively, we could have passed check_binary_allowed to build in pip wheel mode. The only difference is that wheels built locally from *legacy* packages would then not be cached, when pip wheel is used with --no-binary.
Diffstat (limited to 'src/pip/_internal/wheel_builder.py')
-rw-r--r--src/pip/_internal/wheel_builder.py18
1 files changed, 3 insertions, 15 deletions
diff --git a/src/pip/_internal/wheel_builder.py b/src/pip/_internal/wheel_builder.py
index 5940e4ad9..7c7820d4f 100644
--- a/src/pip/_internal/wheel_builder.py
+++ b/src/pip/_internal/wheel_builder.py
@@ -107,7 +107,6 @@ def should_build_for_install_command(
def _should_cache(
req, # type: InstallRequirement
- check_binary_allowed, # type: BinaryAllowedPredicate
):
# type: (...) -> Optional[bool]
"""
@@ -116,7 +115,7 @@ def _should_cache(
has determined a wheel needs to be built.
"""
if not should_build_for_install_command(
- req, check_binary_allowed=check_binary_allowed
+ req, check_binary_allowed=_always_true
):
# never cache if pip install would not have built
# (editable mode, etc)
@@ -144,17 +143,13 @@ def _should_cache(
def _get_cache_dir(
req, # type: InstallRequirement
wheel_cache, # type: WheelCache
- check_binary_allowed, # type: BinaryAllowedPredicate
):
# type: (...) -> str
"""Return the persistent or temporary cache directory where the built
wheel need to be stored.
"""
cache_available = bool(wheel_cache.cache_dir)
- if (
- cache_available and
- _should_cache(req, check_binary_allowed)
- ):
+ if cache_available and _should_cache(req):
cache_dir = wheel_cache.get_path_for_link(req.link)
else:
cache_dir = wheel_cache.get_ephem_path_for_link(req.link)
@@ -263,7 +258,6 @@ def build(
wheel_cache, # type: WheelCache
build_options, # type: List[str]
global_options, # type: List[str]
- check_binary_allowed=None, # type: Optional[BinaryAllowedPredicate]
):
# type: (...) -> BuildResult
"""Build wheels.
@@ -271,10 +265,6 @@ def build(
:return: The list of InstallRequirement that succeeded to build and
the list of InstallRequirement that failed to build.
"""
- if check_binary_allowed is None:
- # Binaries allowed by default.
- check_binary_allowed = _always_true
-
if not requirements:
return [], []
@@ -287,9 +277,7 @@ def build(
with indent_log():
build_successes, build_failures = [], []
for req in requirements:
- cache_dir = _get_cache_dir(
- req, wheel_cache, check_binary_allowed
- )
+ cache_dir = _get_cache_dir(req, wheel_cache)
wheel_file = _build_one(
req, cache_dir, build_options, global_options
)