-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
uninstall: remove symlinks created by flit install --symlink #6914
Conversation
fb55f10
to
cbf3e9c
Compare
@cjerdonek thanks for the review. Simplification done. |
@sbidoul Thanks for the updates. Re: your comment here on the original issue:
Can you point out whether / how this PR addresses that? Is a code comment warranted if this was an issue that went unnoticed in the past? |
@cjerdonek I just extracted the part concerning stash/commit/rollback of symlinks in a separate commit and added extensive tests. There is also an integration test for the mode change: pip/tests/functional/test_uninstall.py Line 479 in f8d5825
|
Sorry, I didn't mean to suggest this PR should (or needed) to address that comment. I was just asking because I wasn't sure. Does the second fix have to go with the first fix? In other words, would it cause problems if only the first part was done? If not, I think it would be better to do the second part as a separate issue and PR because it seems like a distinct issue and would make it easier to understand and review. |
I think both should be addressed together. Before this PR, uninstalling was merely leaving symlinks behind in the virtualenv. With the first part of this PR, the symlinks get removed but the stash mechanism corrupts the symlink targets. So I think only merging the first part would make the situation worse and it's best to fix the stashing mechanism at the same time. Is the separate commit sufficient to facilitate review or do you prefer a separate PR and merge them together? |
Also, the test for part 2 needs improvements in |
Okay, this is good to know then. Before you had proposed only the first part without mentioning that more work needed to be done.
If both parts need to be committed together, then it should be one PR. |
@@ -427,10 +427,12 @@ def is_local(path): | |||
|
|||
If we're not in a virtualenv, all paths are considered "local." | |||
|
|||
Caution: this function assumes the head of path has been normalized |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just normalize the head of path here and below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could, but I think the callers need to do it too anyway, so for the use cases we have it would be redundant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better redundant and give a consistent interface with no gotchas IMO, but I won't block this on this point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Thanks! |
Fixes #6892
This PR adds a failing test and a fix for uninstalling in a scenario that is very close to what
flit install --symlink
does.The fix has two parts:
is_local
that was defeating careful head normalization inreq_uninstall.py
.StashedUninstallPathSet