mirror of https://github.com/pypa/pip
Merge pull request #3904 from minrk/egg-link-priority
don't assume egg-link corresponds to dist to uninstall
This commit is contained in:
commit
c96f850b17
|
@ -683,6 +683,10 @@ class InstallRequirement(object):
|
|||
'easy-install.pth')
|
||||
paths_to_remove.add_pth(easy_install_pth, './' + easy_install_egg)
|
||||
|
||||
elif egg_info_exists and dist.egg_info.endswith('.dist-info'):
|
||||
for path in pip.wheel.uninstallation_paths(dist):
|
||||
paths_to_remove.add(path)
|
||||
|
||||
elif develop_egg_link:
|
||||
# develop egg
|
||||
with open(develop_egg_link, 'r') as fh:
|
||||
|
@ -696,10 +700,6 @@ class InstallRequirement(object):
|
|||
'easy-install.pth')
|
||||
paths_to_remove.add_pth(easy_install_pth, dist.location)
|
||||
|
||||
elif egg_info_exists and dist.egg_info.endswith('.dist-info'):
|
||||
for path in pip.wheel.uninstallation_paths(dist):
|
||||
paths_to_remove.add(path)
|
||||
|
||||
else:
|
||||
logger.debug(
|
||||
'Not sure how to uninstall: %s - Check: %s',
|
||||
|
|
|
@ -428,3 +428,30 @@ def test_uninstall_setuptools_develop_install(script, data):
|
|||
) in uninstall2.files_deleted, list(uninstall2.files_deleted.keys())
|
||||
list_result2 = script.pip('list', '--format=legacy')
|
||||
assert "FSPkg" not in list_result2.stdout
|
||||
|
||||
|
||||
def test_uninstall_editable_and_pip_install(script, data):
|
||||
"""Try uninstall after pip install -e after pip install"""
|
||||
# SETUPTOOLS_SYS_PATH_TECHNIQUE=raw removes the assumption that `-e`
|
||||
# installs are always higher priority than regular installs.
|
||||
# This becomes the default behavior in setuptools 25.
|
||||
script.environ['SETUPTOOLS_SYS_PATH_TECHNIQUE'] = 'raw'
|
||||
|
||||
pkg_path = data.packages.join("FSPkg")
|
||||
script.pip('install', '-e', '.',
|
||||
expect_stderr=True, cwd=pkg_path)
|
||||
# ensure both are installed with --ignore-installed:
|
||||
script.pip('install', '--ignore-installed', '.',
|
||||
expect_stderr=True, cwd=pkg_path)
|
||||
list_result = script.pip('list', '--format=legacy')
|
||||
assert "FSPkg (0.1.dev0, " in list_result.stdout
|
||||
# Uninstall both develop and install
|
||||
uninstall = script.pip('uninstall', 'FSPkg', '-y')
|
||||
assert not any(filename.endswith('.egg-link')
|
||||
for filename in uninstall.files_deleted.keys())
|
||||
uninstall2 = script.pip('uninstall', 'FSPkg', '-y')
|
||||
assert join(
|
||||
script.site_packages, 'FSPkg.egg-link'
|
||||
) in uninstall2.files_deleted, list(uninstall2.files_deleted.keys())
|
||||
list_result2 = script.pip('list', '--format=legacy')
|
||||
assert "FSPkg" not in list_result2.stdout
|
||||
|
|
Loading…
Reference in New Issue