diff --git a/news/8733.bugfix b/news/8733.bugfix new file mode 100644 index 00000000000..027e85f6496 --- /dev/null +++ b/news/8733.bugfix @@ -0,0 +1 @@ +Correctly uninstall console scripts installed to ~/.local/bin diff --git a/src/pip/_internal/locations.py b/src/pip/_internal/locations.py index 0c1235488d6..683269305c9 100644 --- a/src/pip/_internal/locations.py +++ b/src/pip/_internal/locations.py @@ -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 diff --git a/src/pip/_internal/req/req_uninstall.py b/src/pip/_internal/req/req_uninstall.py index 69719d338e6..4563941df46 100644 --- a/src/pip/_internal/req/req_uninstall.py +++ b/src/pip/_internal/req/req_uninstall.py @@ -46,6 +46,7 @@ def _script_names(dist, script_name, is_gui): bin_dir = bin_user else: bin_dir = bin_py + assert bin_dir is not None exe_name = os.path.join(bin_dir, script_name) paths_to_remove = [exe_name] if WINDOWS: @@ -562,6 +563,7 @@ def from_dist(cls, dist): bin_dir = bin_user else: bin_dir = bin_py + assert bin_dir is not None paths_to_remove.add(os.path.join(bin_dir, script)) if WINDOWS: paths_to_remove.add(os.path.join(bin_dir, script) + '.bat')