-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
fix: Gracefully handle read-only sdists #1140
Conversation
poetry/utils/helpers.py
Outdated
@@ -27,19 +27,18 @@ def normalize_version(version): # type: (str) -> str | |||
return str(Version(version)) | |||
|
|||
|
|||
def del_ro(action, name, exc): |
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.
Having a check that making the file writable will fix the error raised by rmtree (or that the error was raised because of being nonwriteable) wouldn't hurt. In case different error ocurred, making a file writable might be unwanted? But that's just me guessing.
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.
Considering this is being applied to a temp directory, specifically one being used for unpacking sdist's, I doubt making something writeable before deletion would hurt anything.
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.
Thinking about it, my comment really comes from worrying that the code isn't self-documenting in this case and might benefit from a comment explaining why there's the `onerror, what is it supposed to handle... But that's just my personal feeling.
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.
Personally, I feel that the "what" is clear (delete read-only files), the problem is the "why" which is that some sdist's contain read-only files.
The question is whether that kind of "why" lives better in a comment or in a commit message. Personally, this feels more like the type of historical information that is best left in a commit message but I can also see the case for why it could be a comment.
So I'm fine changing this if its what is needed to get this PR accepted.
Hmm, should this have been against |
@iScrE4m , @epage I would really benefit from this change as well. What would be the next step to get this included? |
Is there anything blocking this from being reviewed (and approved)? It's a simple change, but without it is a huge snag. |
@iScrE4m sorry to ping, but I'm hoping to see this PR get in if it is acceptable. If not, can you leave actionable feedback and hopefully someone picks it up? |
@RoscoP I wish I could help, but I’m just a random guy who wanted to help Poetry a bit and randomly reviewed this PR. |
This change is now rebased and targeting master since I'm assuming that is more correct? Would be nice to have guidance |
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.
Looks good to me. Thanks a lot 👍
I wonder why the tests haven't started. So could you please commit any small change to force rerunning the tests?
fin swimmer
Rebase and repushed which queued the tests back up |
Tests passed. Looks like this is ready @finswimmer |
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.
Thanks a lot 👍
Looks good to me!
@finswimmer with this being approved, what is the next step for merging? |
Any love for this PR? It's the only thing holding us back from adopting |
I would love to see this fix get in, just ran into this issue with p4python yesterday. |
Can we get this in please? This would help us to adopt poetry in our company. Thank you!! |
I too ran into this issue. Can the maintainers please accept the fix. Thanks! |
@sdispater - Sorry to pester, hoping this PR can make it in soon or maybe tied to a milestone. |
Hello @epage, sorry for ping you again. As the checks have changed and so not all necessary test are completed, one more push to force rerunning the test is needed :( I promise to merge this PR than just in time. Thanks a lot! fin swimmer |
For a package without dependencies in pypi's database, like p4python, the sdist is required. The problem is p4python was developed in perforce where all files are read-only by default and deleting the temp directory fails. So we need to use the custom-built temp directory and specially handle read-only files to be able to use p4python in poetry. Fixes python-poetry#520
@finswimmer just did a new push |
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.
Thanks a lot!
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
For a package without dependencies in pypi's database, like p4python,
the sdist is required. The problem is p4python was developed in
perforce where all files are read-only by default and deleting the temp
directory fails.
So we need to use the custom-built temp directory and specially handle
read-only files to be able to use p4python in poetry.
Fixes #520
Pull Request Check List
This is just a reminder about the most common mistakes. Please make sure that you tick all appropriate boxes. But please read our contribution guide at least once, it will save you unnecessary review cycles!
Updated documentation for changed code.N/ANote: If your Pull Request introduces a new feature or changes the current behavior, it should be based
on the
develop
branch. If it's a bug fix or only a documentation update, it should be based on themaster
branch.If you have any questions to any of the points above, just submit and ask! This checklist is here to help you, not to deter you from contributing!