Skip to content

Commit

Permalink
Move monkeypatching of metadata 2.0 support to a more proper place
Browse files Browse the repository at this point in the history
It was done in the support code for the wheel file format but it
affects metadata loading from all supported distribution types. Move
it to generic code.
  • Loading branch information
dnicolodi committed Dec 11, 2024
1 parent 0d532e8 commit 73e8537
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
12 changes: 12 additions & 0 deletions twine/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@
from twine import sdist
from twine import wheel

# Monkeypatch Metadata 2.0 support
metadata._VALID_METADATA_VERSIONS = [
"1.0",
"1.1",
"1.2",
"2.0",
"2.1",
"2.2",
"2.3",
"2.4",
]

DIST_TYPES = {
"bdist_wheel": wheel.Wheel,
"sdist": sdist.SDist,
Expand Down
6 changes: 0 additions & 6 deletions twine/wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,9 @@
import zipfile
from typing import List

import packaging.metadata

from twine import distribution
from twine import exceptions

# Monkeypatch Metadata 2.0 support
packaging.metadata._VALID_METADATA_VERSIONS = ["1.0", "1.1", "1.2", "2.0", "2.1", "2.2", "2.3", "2.4"]


wheel_file_re = re.compile(
r"""^(?P<namever>(?P<name>.+?)(-(?P<ver>\d.+?))?)
((-(?P<build>\d.*?))?-(?P<pyver>.+?)-(?P<abi>.+?)-(?P<plat>.+?)
Expand Down

0 comments on commit 73e8537

Please sign in to comment.