mirror of
https://github.com/pypa/pip
synced 2023-12-13 21:30:23 +01:00
Re-install local candidates unconditionally
Signed-off-by: Pradyun Gedam <pradyunsg@users.noreply.github.com>
This commit is contained in:
parent
84382715f0
commit
ce46a5e36d
2 changed files with 46 additions and 2 deletions
|
@ -132,15 +132,19 @@ class Resolver(BaseResolver):
|
||||||
|
|
||||||
# Check if there is already an installation under the same name,
|
# Check if there is already an installation under the same name,
|
||||||
# and set a flag for later stages to uninstall it, if needed.
|
# 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 --force-reinstall flag is set. Always reinstall.
|
||||||
# * The installation is different in version or editable-ness, so
|
# * The installation is different in version or editable-ness, so
|
||||||
# we need to uninstall it to install the new distribution.
|
# we need to uninstall it to install the new distribution.
|
||||||
# * The installed version is the same as the pending 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)
|
installed_dist = self.factory.get_dist_to_uninstall(candidate)
|
||||||
if installed_dist is None:
|
if installed_dist is None:
|
||||||
ireq.should_reinstall = False
|
ireq.should_reinstall = False
|
||||||
|
elif candidate.source_link.is_file:
|
||||||
|
ireq.should_reinstall = True
|
||||||
elif self.factory.force_reinstall:
|
elif self.factory.force_reinstall:
|
||||||
ireq.should_reinstall = True
|
ireq.should_reinstall = True
|
||||||
elif installed_dist.parsed_version != candidate.version:
|
elif installed_dist.parsed_version != candidate.version:
|
||||||
|
|
|
@ -1193,3 +1193,43 @@ def test_new_resolver_contraint_on_dep_with_extra(script):
|
||||||
"simple",
|
"simple",
|
||||||
)
|
)
|
||||||
assert_installed(script, simple="1", dep="1", depx="1")
|
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 a new issue