Skip to content

Commit

Permalink
Fix uninstallation of user scripts
Browse files Browse the repository at this point in the history
User scripts are installed to ~/.local/bin. pip was looking for scripts
to uninstall in ~/.local/lib/python3.8/site-packages/bin. This commit
makes it look in ~/.local/bin instead.
  • Loading branch information
DaanDeMeyer committed Aug 8, 2020
1 parent 2e4d748 commit 4fad37f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions news/8733.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Correctly uninstall console scripts installed to ~/.local/bin
4 changes: 2 additions & 2 deletions src/pip/_internal/locations.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,16 @@ def get_src_prefix():
except AttributeError:
user_site = site.USER_SITE

bin_user = sysconfig.get_path('scripts')

if WINDOWS:
bin_py = os.path.join(sys.prefix, 'Scripts')
bin_user = os.path.join(user_site, 'Scripts')
# buildout uses 'bin' on Windows too?
if not os.path.exists(bin_py):
bin_py = os.path.join(sys.prefix, 'bin')
bin_user = os.path.join(user_site, 'bin')
else:
bin_py = os.path.join(sys.prefix, 'bin')
bin_user = os.path.join(user_site, 'bin')

# Forcing to use /usr/local/bin for standard macOS framework installs
# Also log to ~/Library/Logs/ for use with the Console.app log viewer
Expand Down
1 change: 1 addition & 0 deletions tests/functional/test_uninstall_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def test_uninstall_editable_from_usersite(self, script, data):
# uninstall
result2 = script.pip('uninstall', '-y', 'FSPkg')
assert not isfile(script.base_path / egg_link)
assert not isfile(script)

assert_all_changes(
result1,
Expand Down

0 comments on commit 4fad37f

Please sign in to comment.