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

Only allow one top-level .dist-info directory in wheels #7494

Merged
merged 4 commits into from
Dec 22, 2019

Conversation

chrahunt
Copy link
Member

@chrahunt chrahunt commented Dec 16, 2019

Original justification is in the linked issue. The current improvement is small, but this will be a useful simplification later when refactoring to install directly from wheel files since we can search directly for metadata files by matching on e.g. ^[^/]+\.dist-info/WHEEL$.

For any impacted packages (i.e. intel-tensorflow), a workaround could be to put the non-primary .dist-info into *.data/purelib.

Fixes #7487.

@chrahunt chrahunt added type: refactor Refactoring code skip news Does not need a NEWS file entry (eg: trivial changes) labels Dec 16, 2019
@chrahunt chrahunt marked this pull request as ready for review December 17, 2019 00:33
@pradyunsg
Copy link
Member

I think we should:

  • document the exact work around (even if it's in a comment here)
  • add tests for the invalid and valid cases here

@chrahunt
Copy link
Member Author

Workaround is described in #7487 (comment).

@chrahunt
Copy link
Member Author

Added test here.

@pradyunsg pradyunsg removed the skip news Does not need a NEWS file entry (eg: trivial changes) label Dec 21, 2019
@chrahunt chrahunt force-pushed the refactor/wheel-metadata-retrieval branch from 9e4d41f to 76ade1f Compare December 21, 2019 16:23
This aligns with the previous behavior that would have enforced the
found .dist-info directory starting with the name of the package.

We raise UnsupportedWheel because it looks better in output than the
AssertionError (which includes traceback).
@chrahunt chrahunt force-pushed the refactor/wheel-metadata-retrieval branch from 76ade1f to 649a4f3 Compare December 22, 2019 02:28
@chrahunt chrahunt merged commit 92da786 into pypa:master Dec 22, 2019
@chrahunt chrahunt deleted the refactor/wheel-metadata-retrieval branch December 22, 2019 21:41
@chrahunt
Copy link
Member Author

Thank you both for reviewing!

jsirois added a commit to jsirois/pip that referenced this pull request Dec 27, 2019
It seems pypa#7494 disallows non top-level .dist-info dirs. This appears to
not have been intentional. Restore support for wheels with nested
(vendored) distributions since they do not pose ambiguity probmens for
pip.
jsirois added a commit to pex-tool/pip that referenced this pull request Dec 27, 2019
It seems pypa#7494 disallows non top-level .dist-info dirs. This appears to
not have been intentional. Restore support for wheels with nested
(vendored) distributions since they do not pose ambiguity probmens for
pip.
@sbidoul
Copy link
Member

sbidoul commented Dec 28, 2019

@chrahunt are you aware this PR breaks pip install twine, due to a .distinfo directory of a vendored library inside the bleach package?

AssertionError: Multiple .dist-info directories: /home/sbidoul/.virtualenvs/tempenv-17a32962758cb/lib/python3.7/site-packages/bleach/_vendor/html5lib-1.0.1.dist-info, /home/sbidoul/.virtualenvs/tempenv-17a32962758cb/lib/python3.7/site-packages/bleach-3.1.0.dist-info

@chrahunt
Copy link
Member Author

Thanks, I see the problem - we're not restricting the check to top-level directories. I'll submit a fix shortly.

@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Jan 27, 2020
@lock lock bot locked as resolved and limited conversation to collaborators Jan 27, 2020
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 type: refactor Refactoring code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pip sometimes prohibits 2 .dist-info directories in wheels
4 participants