From 538754725d5214e16386e567af77d12c08d8b920 Mon Sep 17 00:00:00 2001 From: Tzu-ping Chung Date: Thu, 18 Nov 2021 18:17:20 +0800 Subject: [PATCH] Revise locally available dist reinstallation logic A PEP-508 file:// requirement pointing to a wheel is not longer automatically reinstalled. But an sdist from file://, or anything specifed by a path will automatically be reinstalled. --- src/pip/_internal/resolution/resolvelib/resolver.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/pip/_internal/resolution/resolvelib/resolver.py b/src/pip/_internal/resolution/resolvelib/resolver.py index ca07cb49e63..10da7ac7e81 100644 --- a/src/pip/_internal/resolution/resolvelib/resolver.py +++ b/src/pip/_internal/resolution/resolvelib/resolver.py @@ -111,10 +111,10 @@ def _get_ireq( # Determine whether to upgrade based on flags and whether the installed # distribution was done via a direct URL. - # Always reinstall an incoming wheel candidate on the local filesystem. - # This is quite fast anyway, and we can avoid drama when users want - # their in-development direct URL requirement automatically reinstalled. - if cand_link.is_file and cand_link.is_wheel: + # Always reinstall a direct URL on the file system if it's not specified + # with PEP 508. This avoids drama when users want their in-development + # requirement automatically reinstalled. + if cand_link.is_file and (ireq.req is None or ireq.req.url is None): return ireq # Reinstall if --upgrade is specified.