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

Conversation

HaraldNordgren
Copy link

@HaraldNordgren HaraldNordgren commented May 25, 2018

Fixes #5439.

@HaraldNordgren HaraldNordgren force-pushed the issues/5439 branch 2 times, most recently from 875937a to ac20718 Compare May 26, 2018 10:46
@HaraldNordgren HaraldNordgren changed the title Solving issues/5439. Uninstall check should use samefile(), not . Handle symlinks in req_uninstall.py (solves issue 5439) May 26, 2018
@HaraldNordgren HaraldNordgren changed the title Handle symlinks in req_uninstall.py (solves issue 5439) Handle symlinks in req_uninstall.py May 26, 2018
@@ -359,7 +359,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 (os.stat(link_pointer) == os.stat(dist.location)), (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should use os.path.samefile, as this is defined to do precisely this job. You may need to fall back to something else on Python 2.7, as samefile only added Windows support in Python 3.2, but I'm not sure if a stat comparison is sufficient on before Python 3.4 on Windows (the docs to samefile say "Changed in version 3.4: Windows now uses the same implementation as all other platforms" which implies that prior to that, Windows needed special treatment).

OTOH, this is "only" an assertion, not a normal error - so maybe it could be removed if it's asserting something that isn't always true? What do the other @pypa/pip-committers think?

@HaraldNordgren HaraldNordgren force-pushed the issues/5439 branch 2 times, most recently from ed00a03 to 3e948a3 Compare June 5, 2018 15:41
Handle symlinks in req_uninstall.py
@HaraldNordgren
Copy link
Author

@pfmoore Updated.

@pfmoore pfmoore dismissed their stale review June 6, 2018 08:10

Review comments addressed. I'm not going so far as to "approve" this change, though. There's still the question of do we need the assertion anyway. Unfortunately, github doesn't offer a plain "Confirm review comments have been addressed without approving" button...

@HaraldNordgren
Copy link
Author

HaraldNordgren commented Sep 18, 2018

@pfmoore Created a new version here instead #5793.

@lock
Copy link

lock bot commented May 28, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label May 28, 2019
@lock lock bot locked as resolved and limited conversation to collaborators May 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

uninstall check should use samefile(), not ==
3 participants