diff options
author | Xavier Fernandez <xav.fernandez@gmail.com> | 2016-10-29 14:39:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-29 14:39:50 +0200 |
commit | c96f850b17c0b9417e204fcafe6a7a6526e7574b (patch) | |
tree | 22887bc546109899a07ac017c9bb389733b495cc | |
parent | e53e2247d957572716d115f8666d6eeab6133a22 (diff) | |
parent | b8f31ac522d6beef9e88ef0eb8262ea1c66a3d4b (diff) | |
download | pip-c96f850b17c0b9417e204fcafe6a7a6526e7574b.tar.gz |
Merge pull request #3904 from minrk/egg-link-priority
don't assume egg-link corresponds to dist to uninstall
-rw-r--r-- | pip/req/req_install.py | 8 | ||||
-rw-r--r-- | tests/functional/test_uninstall.py | 27 |
2 files changed, 31 insertions, 4 deletions
diff --git a/pip/req/req_install.py b/pip/req/req_install.py index 5defe5916..f9a66e0f2 100644 --- a/pip/req/req_install.py +++ b/pip/req/req_install.py @@ -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', diff --git a/tests/functional/test_uninstall.py b/tests/functional/test_uninstall.py index 6fe43b5fa..61aff3b1b 100644 --- a/tests/functional/test_uninstall.py +++ b/tests/functional/test_uninstall.py @@ -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 |