summaryrefslogtreecommitdiff
path: root/src/pip
diff options
context:
space:
mode:
authorPradyun Gedam <pradyunsg@users.noreply.github.com>2020-11-20 13:47:49 +0000
committerPradyun Gedam <pradyunsg@users.noreply.github.com>2020-11-25 14:13:04 +0000
commitd6e3643fd981890205cd941c510da3c987687666 (patch)
tree087f556f4d65a61d3e831fa8a8c24e7c9e3254b3 /src/pip
parentbb7fce7209fd678f593faadf34270a6c09e60a5f (diff)
downloadpip-d6e3643fd981890205cd941c510da3c987687666.tar.gz
Print a message and don't reinstall wheels
Also, adds a test for source distributions being reinstalled. Signed-off-by: Pradyun Gedam <pradyunsg@users.noreply.github.com>
Diffstat (limited to 'src/pip')
-rw-r--r--src/pip/_internal/resolution/resolvelib/resolver.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/pip/_internal/resolution/resolvelib/resolver.py b/src/pip/_internal/resolution/resolvelib/resolver.py
index 6290d2fe3..f29b9692b 100644
--- a/src/pip/_internal/resolution/resolvelib/resolver.py
+++ b/src/pip/_internal/resolution/resolvelib/resolver.py
@@ -134,23 +134,31 @@ class Resolver(BaseResolver):
# and set a flag for later stages to uninstall it, if needed.
#
# * There is no existing installation. Nothing to uninstall.
- # * The candidate is a local path/file. Always reinstall.
# * The --force-reinstall flag is set. Always reinstall.
# * The installation is different in version or editable-ness, so
# we need to uninstall it to install the new distribution.
- # * The installed version is the same as the pending distribution.
- # Skip this distribution altogether to save work.
+ # * The installed version is different from the pending distribution.
+ # * The candidate is a local wheel. Do nothing.
+ # * The candidate is a local path. Always reinstall.
installed_dist = self.factory.get_dist_to_uninstall(candidate)
if installed_dist is None:
ireq.should_reinstall = False
- elif candidate.source_link.is_file:
- ireq.should_reinstall = True
elif self.factory.force_reinstall:
ireq.should_reinstall = True
elif installed_dist.parsed_version != candidate.version:
ireq.should_reinstall = True
elif dist_is_editable(installed_dist) != candidate.is_editable:
ireq.should_reinstall = True
+ elif candidate.source_link.is_file:
+ if candidate.source_link.is_wheel:
+ logger.info(
+ "%s is already installed with the same version as the "
+ "provided wheel. Use --force-reinstall to force an "
+ "installation of the wheel.",
+ ireq.name,
+ )
+ continue
+ ireq.should_reinstall = True
else:
continue