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

Allow + in wheel filenames #388

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Allow + in wheel filenames
  • Loading branch information
ksunden committed Jan 24, 2021
commit ae3f6ae01b1a7c45be897595b24acc26bb06875a
2 changes: 1 addition & 1 deletion flit_core/flit_core/wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def wheel_filename(self):
tag = ('py2.' if self.metadata.supports_py2 else '') + 'py3-none-any'
return '{}-{}-{}.whl'.format(
re.sub(r"[^\w\d.]+", "_", self.metadata.name, flags=re.UNICODE),
re.sub(r"[^\w\d.]+", "_", self.metadata.version, flags=re.UNICODE),
re.sub(r"[^\w\d\+.]+", "_", self.metadata.version, flags=re.UNICODE),
tag)
Comment on lines 102 to 105
Copy link
Contributor

@flying-sheep flying-sheep Mar 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In compliance with the recently changed spec, this should be the correct:

Suggested change
return '{}-{}-{}.whl'.format(
re.sub(r"[^\w\d.]+", "_", self.metadata.name, flags=re.UNICODE),
re.sub(r"[^\w\d.]+", "_", self.metadata.version, flags=re.UNICODE),
re.sub(r"[^\w\d\+.]+", "_", self.metadata.version, flags=re.UNICODE),
tag)
# See https://packaging.python.org/specifications/binary-distribution-format/#escaping-and-unicode
assert '-' not in self.metadata.version, 'Normalized versions can’t have dashes'
return '{}-{}-{}.whl'.format(
re.sub(r"[-_.]+", "_", self.metadata.name, flags=re.UNICODE),
self.metadata.version,
tag)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where does self.metadata.version come from? Dashes are allowed in Core metadata (the field used in the {name}-{version}.dist-info/METADATA file), so the assertion may not be correct depending on how Flit implements this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think @flying-sheep's suggestion is correct - so long as our implementation of version normalisation is correct (and I've read PEP 440 correctly!), there should be no dashes in version.

I'd also like to check when constructing the filename that the compatibility tag has exactly two dashes ({python tag}-{abi tag}-{platform tag}), to avoid any nasty surprises. But that check can be added later.


def _add_file_old(self, full_path, rel_path):
Expand Down