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

Normalize wheel filenames #135

Closed
wants to merge 2 commits into from
Closed

Conversation

stefanor
Copy link
Contributor

@stefanor stefanor commented Aug 15, 2022

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

Allowing us to unpack wheels with non-normalized filenames.

Part of pypa#97, but doesn't retrieve the names from distribution metadata,
yet.

Fixes: pypa#134
@@ -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])
Copy link
Member

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.

Copy link
Member

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. :)

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

Copy link
Member

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.

@stefanor stefanor closed this Aug 16, 2022
@stefanor stefanor deleted the normalize-names branch August 16, 2022 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Resolve normalised vs original distribution names Can't install wheels with non-normalized names
2 participants