-
Notifications
You must be signed in to change notification settings - Fork 52
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
Normalize wheel filenames #135
Conversation
3e2e542
to
2d86655
Compare
@@ -101,7 +109,9 @@ def parse_wheel_filename(filename: str) -> WheelFilename: | |||
wheel_info = _WHEEL_FILENAME_REGEX.match(filename) | |||
if not wheel_info: | |||
raise ValueError(f"Not a valid wheel filename: {filename}") | |||
return WheelFilename(*wheel_info.groups()) | |||
parsed = wheel_info.groups() | |||
normalized_name = normalize_distribution_name(parsed[0]) |
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.
Sadly, we don't know for sure if the name inside the wheel will be canonicalized.
For example, zope.interface
's wheels contain zope.interface-5.4.0.dist-info
(and not zope-interface
) thanks, in no small part, to setuptools' behaviour in this area.
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.
Oh, wait, that's what this is doing. :)
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.
So, we're going to either need to probe a few names, or search the directory listing.
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.
I see pip searches the zip for a .dist-info
. So I guess we should do that.
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.
I agree. Let's close this out, since we've established that merely canonicalising the name isn't sufficient.
This is a fairly simple solution to #134, without any refactoring needed to close #97.
There are other places this normalization could be done, but this seems like the logical place to do it. It does mean that you can't get back from a
WheelFilename
object to the filename on disk, but that doesn't seem very important.Fixes: #134