diff --git a/twine/package.py b/twine/package.py index 00a59f96..26da5e54 100644 --- a/twine/package.py +++ b/twine/package.py @@ -29,6 +29,18 @@ from twine import wheel from twine import wininst +# 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, "bdist_wininst": wininst.WinInst, diff --git a/twine/wheel.py b/twine/wheel.py index 430d0a3b..be274d5a 100644 --- a/twine/wheel.py +++ b/twine/wheel.py @@ -14,17 +14,11 @@ import os import re import zipfile -from typing import List, Literal, Optional - -import packaging.metadata +from typing import List, Optional 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(?P.+?)(-(?P\d.+?))?) ((-(?P\d.*?))?-(?P.+?)-(?P.+?)-(?P.+?)