Skip to content

Commit 4fad37f

Browse files
committed
Fix uninstallation of user scripts
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.
1 parent 2e4d748 commit 4fad37f

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

news/8733.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Correctly uninstall console scripts installed to ~/.local/bin

src/pip/_internal/locations.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,16 +75,16 @@ def get_src_prefix():
7575
except AttributeError:
7676
user_site = site.USER_SITE
7777

78+
bin_user = sysconfig.get_path('scripts')
79+
7880
if WINDOWS:
7981
bin_py = os.path.join(sys.prefix, 'Scripts')
80-
bin_user = os.path.join(user_site, 'Scripts')
8182
# buildout uses 'bin' on Windows too?
8283
if not os.path.exists(bin_py):
8384
bin_py = os.path.join(sys.prefix, 'bin')
8485
bin_user = os.path.join(user_site, 'bin')
8586
else:
8687
bin_py = os.path.join(sys.prefix, 'bin')
87-
bin_user = os.path.join(user_site, 'bin')
8888

8989
# Forcing to use /usr/local/bin for standard macOS framework installs
9090
# Also log to ~/Library/Logs/ for use with the Console.app log viewer

tests/functional/test_uninstall_user.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ def test_uninstall_editable_from_usersite(self, script, data):
6767
# uninstall
6868
result2 = script.pip('uninstall', '-y', 'FSPkg')
6969
assert not isfile(script.base_path / egg_link)
70+
assert not isfile(script)
7071

7172
assert_all_changes(
7273
result1,

0 commit comments

Comments
 (0)