From ebee1cecf8a27fea74c29fb9323ccca2d61bd4e3 Mon Sep 17 00:00:00 2001 From: Pieter Degroote Date: Sun, 17 Oct 2021 19:19:52 +0200 Subject: [PATCH 1/2] Improve error message when egg-link does not match installed location Include the locations of the mismatched locations in the message, to provide more context. --- src/pip/_internal/req/req_uninstall.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/pip/_internal/req/req_uninstall.py b/src/pip/_internal/req/req_uninstall.py index 779e93b44af..b135017907b 100644 --- a/src/pip/_internal/req/req_uninstall.py +++ b/src/pip/_internal/req/req_uninstall.py @@ -530,10 +530,11 @@ def from_dist(cls, dist: Distribution) -> "UninstallPathSet": # develop egg with open(develop_egg_link) as fh: link_pointer = os.path.normcase(fh.readline().strip()) - assert ( - link_pointer == dist.location - ), "Egg-link {} does not match installed location of {} (at {})".format( - link_pointer, dist.project_name, dist.location + assert link_pointer == dist.location, ( + "Egg-link located at {} and pointing to {} does not match " + "installed location of {} at {}".format( + develop_egg_link, link_pointer, dist.project_name, dist.location + ) ) paths_to_remove.add(develop_egg_link) easy_install_pth = os.path.join( From ae9c0fd8a8cf42f70534ae7ec4ae865735389eb8 Mon Sep 17 00:00:00 2001 From: Pieter Degroote Date: Wed, 20 Oct 2021 20:24:33 +0200 Subject: [PATCH 2/2] Add news entry for improved error message Co-authored-by: Pradyun Gedam Co-authored-by: Tzu-ping Chung --- news/10476.feature.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/10476.feature.rst diff --git a/news/10476.feature.rst b/news/10476.feature.rst new file mode 100644 index 00000000000..7c2757771a7 --- /dev/null +++ b/news/10476.feature.rst @@ -0,0 +1 @@ +Specify egg-link location in assertion message when it does not match installed location to provide better error message for debugging.