mirror of https://github.com/pypa/pip
Re-install local candidates unconditionally
Signed-off-by: Pradyun Gedam <pradyunsg@users.noreply.github.com>
This commit is contained in:
parent
84382715f0
commit
ce46a5e36d
|
@ -132,15 +132,19 @@ class Resolver(BaseResolver):
|
|||
|
||||
# Check if there is already an installation under the same name,
|
||||
# and set a flag for later stages to uninstall it, if needed.
|
||||
# * There isn't, good -- no uninstalltion 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 distrubiton altogether to save work.
|
||||
# Skip this distribution altogether to save work.
|
||||
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:
|
||||
|
|
|
@ -1193,3 +1193,43 @@ def test_new_resolver_contraint_on_dep_with_extra(script):
|
|||
"simple",
|
||||
)
|
||||
assert_installed(script, simple="1", dep="1", depx="1")
|
||||
|
||||
|
||||
def test_new_resolver_does_reinstall_local_wheels(script):
|
||||
archive_path = create_basic_wheel_for_package(
|
||||
script,
|
||||
"pkg",
|
||||
"1.0",
|
||||
)
|
||||
script.pip(
|
||||
"install", "--no-cache-dir", "--no-index",
|
||||
archive_path,
|
||||
)
|
||||
assert_installed(script, pkg="1.0")
|
||||
|
||||
result = script.pip(
|
||||
"install", "--no-cache-dir", "--no-index",
|
||||
archive_path,
|
||||
)
|
||||
assert "Installing collected packages: pkg" in result.stdout, str(result)
|
||||
assert_installed(script, pkg="1.0")
|
||||
|
||||
|
||||
def test_new_resolver_does_reinstall_local_paths(script):
|
||||
pkg = create_test_package_with_setup(
|
||||
script,
|
||||
name="pkg",
|
||||
version="1.0"
|
||||
)
|
||||
script.pip(
|
||||
"install", "--no-cache-dir", "--no-index",
|
||||
pkg,
|
||||
)
|
||||
assert_installed(script, pkg="1.0")
|
||||
|
||||
result = script.pip(
|
||||
"install", "--no-cache-dir", "--no-index",
|
||||
pkg,
|
||||
)
|
||||
assert "Installing collected packages: pkg" in result.stdout, str(result)
|
||||
assert_installed(script, pkg="1.0")
|
||||
|
|
Loading…
Reference in New Issue