Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle symlinks in req_uninstall.py #5442

Closed
wants to merge 1 commit into from
Closed
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/5439.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Handle symlinks in req_uninstall.py
8 changes: 7 additions & 1 deletion src/pip/_internal/req/req_uninstall.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
)
from pip._internal.utils.temp_dir import TempDirectory

if sys.version_info >= (3, 2):
samefile = os.path.samefile
else:
def samefile(self, other):
return os.stat(self) == os.stat(other)

logger = logging.getLogger(__name__)


Expand Down Expand Up @@ -359,7 +365,7 @@ def from_dist(cls, dist):
# develop egg
with open(develop_egg_link, 'r') as fh:
link_pointer = os.path.normcase(fh.readline().strip())
assert (link_pointer == dist.location), (
assert (samefile(link_pointer, dist.location)), (
'Egg-link %s does not match installed location of %s '
'(at %s)' % (link_pointer, dist.project_name, dist.location)
)
Expand Down