Conversation
…ng wheels A wheel filename may contain non-lowercase characters (e.g. Django-3.2.5.whl) while the .dist-info directory inside uses normalized lowercase naming (django-3.2.5.dist-info/). WheelFile previously derived dist_info_path strictly from the filename, causing a 'Missing RECORD file' error on open. Resolve the actual .dist-info/RECORD path case-insensitively from the zip namelist when the expected path is not found. Fixes pypa#411
Contributor
|
This requires an accompanying regression test and a changelog entry. Will you add those? |
Add test_mixed_case_dist_info that creates a wheel with uppercase filename (MixedCase-1.0-py3-none-any.whl) but lowercase .dist-info directory inside, verifying WheelFile resolves RECORD correctly. Also fix the case-insensitive search term to use lowercase '/record' instead of '/RECORD' when comparing with name.lower(). Add changelog entry in docs/news.rst.
Contributor
Author
|
Thanks for the review! Added regression test + changelog entry. Also fixed a secondary bug in the case-insensitive search term (was |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #686 +/- ##
==========================================
+ Coverage 55.14% 55.39% +0.25%
==========================================
Files 15 15
Lines 1206 1213 +7
==========================================
+ Hits 665 672 +7
Misses 541 541 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Refactor WheelFile usage to use context manager.
Eliminated duplicate code.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A wheel filename may contain non-lowercase characters (e.g.
Django-3.2.5.whl) while the.dist-infodirectory inside uses normalized lowercase naming (django-3.2.5.dist-info/).WheelFilepreviously deriveddist_info_pathstrictly from the filename, causing aMissing RECORD fileerror on open.Fixes #411
Details
When opening a wheel in read mode, if the expected
.dist-info/RECORDpath is not found in the zip namelist, search for a case-insensitive match and use the resolved path for all subsequent operations (RECORD parsing, hash skipping).The fix is confined to
WheelFile.__init__and only activates when the exact-path lookup fails, so there is no performance impact on wheels that already match.