-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[BUG] wheel install_as_egg does not honor file mode #3167
Conversation
@abravalheri can you take a look :) |
@Mergifyio rebase |
✅ Branch has been successfully rebased |
Hi @delijati thank you very much for creating the PR. |
Attempt to fix flake8
Hi @delijati, I did change the PR a little bit for the following reasons:
I hope you don't mind these changes. Please feel free to revert if that works better for you. |
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.
Thank you very much for the PR. I had a look on the code and it looks good. I just left a few notes bellow:
General remarks about the reported issue/proposed fix:
- The
install_as_egg
interface is a non-public interface used internally by setuptools.
This function, as the name suggests, is very likely to be deprecated, but is currently being used byeasy_install
. easy_install
despite being deprecated, is still an internal mechanism used by setuptools for editable installs.- In this context, this PR makes sense, since it can fix potential issues for users using editable installs.
Review comments:
- The CI output seems to indicate that this implementation is OS-specific. Is this approach safe to use on Windows environments? What would be the impact for the users?
- The implementation overrides a non-public API of
ZipFile
.
I understand that the method is not completely private, but this also means that we cannot rely on this approach being stable across future Python versions.
Is this a well-known approach? Is it documented somewhere or used by other big project in the Python community?
I wonder if instead we could use the already existing code in:setuptools/setuptools/archive_util.py
Line 91 in 98728b1
def unpack_zipfile(filename, extract_dir, progress_filter=default_filter):
Hi thanks for looking into that PR.
I know but for now it is the only solution and already used here: buildout/buildout#604
I would skip the test on windows (will add that) as it does "nothing" there. [3]
It is an old Python Bug that seams to be fixed in >= 3.11 [1] And fixes for it are all over the place [2]
I looked into it but that would mean to change the api of all call used by [1] https://bugs.python.org/issue15795 |
Avoid overriding zipfile
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.
Thank you very much @delijati for working in the PR and tests.
I think this change should be mostly fine since it is just applying the same existing behaviour that already exists in setuptools.
It is also relevant since we still depend on this code for editable installs.
Hi @delijati, would you like to add a news fragment for the CHANGELOG? |
Done |
Thank you very much @delijati. We have some pending changes that were already committed to the main branch lately but not released (and other changes scheduled to be merged soon), so I think it would be if we delay this change a little bit1. It would also give the chance for other maintainers with more experience in the codebase to review it. Footnotes
|
Hi @befeleme, I was wondering if a change like this would impact OS packagers. Since you seem to be working with packaging at Red Hat, do you have any thoughts about that? Here we tried to re-use some existing code that handles the unpacking of the wheels, which I honestly feel like it is the right thing to do. However this existing code does explicitly disallow file names in wheels that start with Do you think there might be any existing packages that are forcing file names inside the zip file to install files at arbitrary locations? I had a look on the |
Hi @abravalheri,
If such packages exist, we believe it'd better if they were forbidden to do that. So this feels as an improvement. |
Thank you very much for looking this up @befeleme! I am inclined to merge this PR not exactly in the next release but in the following one, unless the other maintainers/OS re-packagers have any objections. |
Hi @mgorny, @FFY00 I just would like to double check with you if the changes introduced here will somehow impact negatively on Gentoo, Archlinux or any other OS/distribution you help to maintain. This change may affect:
What the change will do:
|
Heh, I'm somewhat confused by this summary. For new packages we tend to use |
Thank you very much @mgorny for the insights. Regarding the confusion: I am under the impression that |
I think a wheel is generated internally and then installed as a egg in Wasn't |
Thank you very much @FFY00 for having a look. So I think it is safe to assume at this point that the change does not affect OS distributions.
|
The internal |
Ah, I see! That makes much more sense to me. I am still not sure if |
Pull Request Checklist
changelog.d/
.(See documentation for details)
See #3166 for more info.