Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions news/8733.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Correctly uninstall script files (from setuptools' ``scripts`` argument), when installed with ``--user``.
17 changes: 14 additions & 3 deletions src/pip/_internal/locations.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,27 @@ def get_src_prefix():
except AttributeError:
user_site = site.USER_SITE


def _get_bin_user():
# type: () -> str
scheme = "{}_user".format(os.name)
if scheme not in sysconfig.get_scheme_names():
scheme = "posix_user" # Default to POSIX for unknown platforms.
path = sysconfig.get_path("scripts", scheme=scheme)
assert path is not None
return path


bin_user = _get_bin_user()

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')
bin_user = os.path.join(os.path.dirname(bin_user), '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