From 88da3441ced8b163eec60b6a1a5f5b2586396eca Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Bidoul?= <stephane.bidoul@gmail.com>
Date: Sun, 26 Apr 2020 11:31:02 +0200
Subject: [PATCH] Simplify _should_cache

The condition "never cache if pip install would not have built"
can be simplified to "do not cache editable requirements".
This is easier to read, and avoid a double warning if the 'wheel'
package is not installed.
---
 src/pip/_internal/wheel_builder.py | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/pip/_internal/wheel_builder.py b/src/pip/_internal/wheel_builder.py
index 6d1022d5661..74f47417974 100644
--- a/src/pip/_internal/wheel_builder.py
+++ b/src/pip/_internal/wheel_builder.py
@@ -118,11 +118,8 @@ def _should_cache(
     wheel cache, assuming the wheel cache is available, and _should_build()
     has determined a wheel needs to be built.
     """
-    if not should_build_for_install_command(
-        req, check_binary_allowed=_always_true
-    ):
-        # never cache if pip install would not have built
-        # (editable mode, etc)
+    if req.editable or not req.source_dir:
+        # never cache editable requirements
         return False
 
     if req.link and req.link.is_vcs: