Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package python-packaging for
openSUSE:Factory checked in at 2021-03-17 20:13:54
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-packaging (Old)
and /work/SRC/openSUSE:Factory/.python-packaging.new.2401 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-packaging"
Wed Mar 17 20:13:54 2021 rev:19 rq:879321 version:20.9
Changes:
--------
--- /work/SRC/openSUSE:Factory/python-packaging/python-packaging.changes
2021-02-01 13:28:22.374118900 +0100
+++
/work/SRC/openSUSE:Factory/.python-packaging.new.2401/python-packaging.changes
2021-03-17 20:15:08.122922259 +0100
@@ -1,0 +2,8 @@
+Tue Feb 2 01:02:21 UTC 2021 - Dirk M??ller <[email protected]>
+
+- update to 20.9:
+ * Run [isort](https://pypi.org/project/isort/) over the code base
(:issue:`377`)
+ * Add support for the ``macosx_10_*_universal2`` platform tags (:issue:`379`)
+ * Introduce ``packaging.utils.parse_wheel_filename()`` and
``parse_sdist_filename()``
+
+-------------------------------------------------------------------
Old:
----
packaging-20.8.tar.gz
New:
----
packaging-20.9.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-packaging.spec ++++++
--- /var/tmp/diff_new_pack.MdNRR4/_old 2021-03-17 20:15:08.874923287 +0100
+++ /var/tmp/diff_new_pack.MdNRR4/_new 2021-03-17 20:15:08.874923287 +0100
@@ -1,7 +1,7 @@
#
# spec file for package python-packaging
#
-# Copyright (c) 2020 SUSE LLC
+# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -26,7 +26,7 @@
%bcond_with test
%endif
Name: python-packaging%{psuffix}
-Version: 20.8
+Version: 20.9
Release: 0
Summary: Core utilities for Python packages
License: Apache-2.0
++++++ packaging-20.8.tar.gz -> packaging-20.9.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/packaging-20.8/.pre-commit-config.yaml
new/packaging-20.9/.pre-commit-config.yaml
--- old/packaging-20.8/.pre-commit-config.yaml 2020-11-21 01:01:12.000000000
+0100
+++ new/packaging-20.9/.pre-commit-config.yaml 2021-01-25 03:19:06.000000000
+0100
@@ -23,6 +23,11 @@
hooks:
- id: black
+ - repo: https://github.com/PyCQA/isort
+ rev: 5.6.4
+ hooks:
+ - id: isort
+
- repo: https://gitlab.com/PyCQA/flake8
rev: "3.7.8"
hooks:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/packaging-20.8/CHANGELOG.rst
new/packaging-20.9/CHANGELOG.rst
--- old/packaging-20.8/CHANGELOG.rst 2020-12-12 05:35:27.000000000 +0100
+++ new/packaging-20.9/CHANGELOG.rst 2021-01-29 21:22:49.000000000 +0100
@@ -1,6 +1,14 @@
Changelog
---------
+20.9 - 2021-01-29
+~~~~~~~~~~~~~~~~~
+
+* Run [isort](https://pypi.org/project/isort/) over the code base
(:issue:`377`)
+* Add support for the ``macosx_10_*_universal2`` platform tags (:issue:`379`)
+* Introduce ``packaging.utils.parse_wheel_filename()`` and
``parse_sdist_filename()``
+ (:issue:`387` and :issue:`389`)
+
20.8 - 2020-12-11
~~~~~~~~~~~~~~~~~
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/packaging-20.8/PKG-INFO new/packaging-20.9/PKG-INFO
--- old/packaging-20.8/PKG-INFO 2020-12-12 05:35:40.400783300 +0100
+++ new/packaging-20.9/PKG-INFO 2021-01-29 21:22:55.306162800 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: packaging
-Version: 20.8
+Version: 20.9
Summary: Core utilities for Python packages
Home-page: https://github.com/pypa/packaging
Author: Donald Stufft and individual contributors
@@ -83,6 +83,14 @@
Changelog
---------
+ 20.9 - 2021-01-29
+ ~~~~~~~~~~~~~~~~~
+
+ * Run [isort](https://pypi.org/project/isort/) over the code base
(`#377 <https://github.com/pypa/packaging/issues/377>`__)
+ * Add support for the ``macosx_10_*_universal2`` platform tags (`#379
<https://github.com/pypa/packaging/issues/379>`__)
+ * Introduce ``packaging.utils.parse_wheel_filename()`` and
``parse_sdist_filename()``
+ (`#387 <https://github.com/pypa/packaging/issues/387>`__ and `#389
<https://github.com/pypa/packaging/issues/389>`__)
+
20.8 - 2020-12-11
~~~~~~~~~~~~~~~~~
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/packaging-20.8/docs/utils.rst
new/packaging-20.9/docs/utils.rst
--- old/packaging-20.8/docs/utils.rst 2019-09-13 11:28:53.000000000 +0200
+++ new/packaging-20.9/docs/utils.rst 2021-01-29 04:13:40.000000000 +0100
@@ -30,7 +30,8 @@
.. function:: canonicalize_version(version)
This function takes a string representing a package version (or a
- ``Version`` instance), and returns the normalized form of it.
+ :class:`~packaging.version.Version` instance), and returns the
+ normalized form of it.
:param str version: The version to normalize.
@@ -39,3 +40,53 @@
>>> from packaging.utils import canonicalize_version
>>> canonicalize_version('1.4.0.0.0')
'1.4'
+
+.. function:: parse_wheel_filename(filename)
+
+ This function takes the filename of a wheel file, and parses it,
+ returning a tuple of name, version, build number, and tags.
+
+ The name part of the tuple is normalized. The version portion is an
+ instance of :class:`~packaging.version.Version`. The build number
+ is ``()`` if there is no build number in the wheel filename,
+ otherwise a two-item tuple of an integer for the leading digits and
+ a string for the rest of the build number. The tags portion is an
+ instance of :class:`~packaging.tags.Tag`.
+
+ :param str filename: The name of the wheel file.
+
+ .. doctest::
+
+ >>> from packaging.utils import parse_wheel_filename
+ >>> from packaging.tags import Tag
+ >>> from packaging.version import Version
+ >>> name, ver, build, tags =
parse_wheel_filename("foo-1.0-py3-none-any.whl")
+ >>> name
+ 'foo'
+ >>> ver == Version('1.0')
+ True
+ >>> tags == {Tag("py3", "none", "any")}
+ True
+ >>> not build
+ True
+
+.. function:: parse_sdist_filename(filename)
+
+ This function takes the filename of a sdist file (as specified
+ in the `Source distribution format`_ documentation), and parses
+ it, returning a tuple of the normalized name and version as
+ represented by an instance of :class:`~packaging.version.Version`.
+
+ :param str filename: The name of the sdist file.
+
+ .. doctest::
+
+ >>> from packaging.utils import parse_sdist_filename
+ >>> from packaging.version import Version
+ >>> name, ver = parse_sdist_filename("foo-1.0.tar.gz")
+ >>> name
+ 'foo'
+ >>> ver == Version('1.0')
+ True
+
+.. _Source distribution format:
https://packaging.python.org/specifications/source-distribution-format/#source-distribution-file-name
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/packaging-20.8/packaging/__about__.py
new/packaging-20.9/packaging/__about__.py
--- old/packaging-20.8/packaging/__about__.py 2020-12-12 05:35:27.000000000
+0100
+++ new/packaging-20.9/packaging/__about__.py 2021-01-29 21:22:49.000000000
+0100
@@ -18,7 +18,7 @@
__summary__ = "Core utilities for Python packages"
__uri__ = "https://github.com/pypa/packaging"
-__version__ = "20.8"
+__version__ = "20.9"
__author__ = "Donald Stufft and individual contributors"
__email__ = "[email protected]"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/packaging-20.8/packaging/markers.py
new/packaging-20.9/packaging/markers.py
--- old/packaging-20.8/packaging/markers.py 2020-05-02 19:34:34.000000000
+0200
+++ new/packaging-20.9/packaging/markers.py 2021-01-25 03:19:06.000000000
+0100
@@ -8,13 +8,21 @@
import platform
import sys
-from pyparsing import ParseException, ParseResults, stringStart, stringEnd
-from pyparsing import ZeroOrMore, Group, Forward, QuotedString
-from pyparsing import Literal as L # noqa
+from pyparsing import ( # noqa: N817
+ Forward,
+ Group,
+ Literal as L,
+ ParseException,
+ ParseResults,
+ QuotedString,
+ ZeroOrMore,
+ stringEnd,
+ stringStart,
+)
from ._compat import string_types
from ._typing import TYPE_CHECKING
-from .specifiers import Specifier, InvalidSpecifier
+from .specifiers import InvalidSpecifier, Specifier
if TYPE_CHECKING: # pragma: no cover
from typing import Any, Callable, Dict, List, Optional, Tuple, Union
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/packaging-20.8/packaging/requirements.py
new/packaging-20.9/packaging/requirements.py
--- old/packaging-20.8/packaging/requirements.py 2020-12-12
00:44:41.000000000 +0100
+++ new/packaging-20.9/packaging/requirements.py 2021-01-25
03:19:06.000000000 +0100
@@ -3,13 +3,22 @@
# for complete details.
from __future__ import absolute_import, division, print_function
-import string
import re
+import string
import sys
-from pyparsing import stringStart, stringEnd, originalTextFor, ParseException
-from pyparsing import ZeroOrMore, Word, Optional, Regex, Combine
-from pyparsing import Literal as L # noqa
+from pyparsing import ( # noqa: N817
+ Combine,
+ Literal as L,
+ Optional,
+ ParseException,
+ Regex,
+ Word,
+ ZeroOrMore,
+ originalTextFor,
+ stringEnd,
+ stringStart,
+)
from ._typing import TYPE_CHECKING
from .markers import MARKER_EXPR, Marker
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/packaging-20.8/packaging/specifiers.py
new/packaging-20.9/packaging/specifiers.py
--- old/packaging-20.8/packaging/specifiers.py 2020-11-14 01:44:03.000000000
+0100
+++ new/packaging-20.9/packaging/specifiers.py 2021-01-25 03:19:06.000000000
+0100
@@ -12,10 +12,10 @@
from ._compat import string_types, with_metaclass
from ._typing import TYPE_CHECKING
from .utils import canonicalize_version
-from .version import Version, LegacyVersion, parse
+from .version import LegacyVersion, Version, parse
if TYPE_CHECKING: # pragma: no cover
- from typing import List, Dict, Union, Iterable, Iterator, Optional,
Callable, Tuple
+ from typing import Callable, Dict, Iterable, Iterator, List, Optional,
Tuple, Union
ParsedVersion = Union[Version, LegacyVersion]
UnparsedVersion = Union[Version, LegacyVersion, str]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/packaging-20.8/packaging/tags.py
new/packaging-20.9/packaging/tags.py
--- old/packaging-20.8/packaging/tags.py 2020-12-12 00:44:41.000000000
+0100
+++ new/packaging-20.9/packaging/tags.py 2021-01-25 03:19:06.000000000
+0100
@@ -27,9 +27,9 @@
if TYPE_CHECKING: # pragma: no cover
from typing import (
+ IO,
Dict,
FrozenSet,
- IO,
Iterable,
Iterator,
List,
@@ -458,14 +458,28 @@
major=major_version, minor=0, binary_format=binary_format
)
- if version >= (11, 0) and arch == "x86_64":
+ if version >= (11, 0):
# Mac OS 11 on x86_64 is compatible with binaries from previous
releases.
# Arm64 support was introduced in 11.0, so no Arm binaries from
previous
# releases exist.
- for minor_version in range(16, 3, -1):
- compat_version = 10, minor_version
- binary_formats = _mac_binary_formats(compat_version, arch)
- for binary_format in binary_formats:
+ #
+ # However, the "universal2" binary format can have a
+ # macOS version earlier than 11.0 when the x86_64 part of the binary
supports
+ # that version of macOS.
+ if arch == "x86_64":
+ for minor_version in range(16, 3, -1):
+ compat_version = 10, minor_version
+ binary_formats = _mac_binary_formats(compat_version, arch)
+ for binary_format in binary_formats:
+ yield "macosx_{major}_{minor}_{binary_format}".format(
+ major=compat_version[0],
+ minor=compat_version[1],
+ binary_format=binary_format,
+ )
+ else:
+ for minor_version in range(16, 3, -1):
+ compat_version = 10, minor_version
+ binary_format = "universal2"
yield "macosx_{major}_{minor}_{binary_format}".format(
major=compat_version[0],
minor=compat_version[1],
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/packaging-20.8/packaging/utils.py
new/packaging-20.9/packaging/utils.py
--- old/packaging-20.8/packaging/utils.py 2020-11-14 01:44:03.000000000
+0100
+++ new/packaging-20.9/packaging/utils.py 2021-01-29 04:13:40.000000000
+0100
@@ -6,23 +6,41 @@
import re
from ._typing import TYPE_CHECKING, cast
+from .tags import Tag, parse_tag
from .version import InvalidVersion, Version
if TYPE_CHECKING: # pragma: no cover
- from typing import NewType, Union
+ from typing import FrozenSet, NewType, Tuple, Union
+ BuildTag = Union[Tuple[()], Tuple[int, str]]
NormalizedName = NewType("NormalizedName", str)
else:
+ BuildTag = tuple
NormalizedName = str
+
+class InvalidWheelFilename(ValueError):
+ """
+ An invalid wheel filename was found, users should refer to PEP 427.
+ """
+
+
+class InvalidSdistFilename(ValueError):
+ """
+ An invalid sdist filename was found, users should refer to the packaging
user guide.
+ """
+
+
_canonicalize_regex = re.compile(r"[-_.]+")
+# PEP 427: The build number must start with a digit.
+_build_tag_regex = re.compile(r"(\d+)(.*)")
def canonicalize_name(name):
# type: (str) -> NormalizedName
# This is taken from PEP 503.
value = _canonicalize_regex.sub("-", name).lower()
- return cast("NormalizedName", value)
+ return cast(NormalizedName, value)
def canonicalize_version(version):
@@ -65,3 +83,56 @@
parts.append("+{0}".format(version.local))
return "".join(parts)
+
+
+def parse_wheel_filename(filename):
+ # type: (str) -> Tuple[NormalizedName, Version, BuildTag, FrozenSet[Tag]]
+ if not filename.endswith(".whl"):
+ raise InvalidWheelFilename(
+ "Invalid wheel filename (extension must be '.whl'):
{0}".format(filename)
+ )
+
+ filename = filename[:-4]
+ dashes = filename.count("-")
+ if dashes not in (4, 5):
+ raise InvalidWheelFilename(
+ "Invalid wheel filename (wrong number of parts):
{0}".format(filename)
+ )
+
+ parts = filename.split("-", dashes - 2)
+ name_part = parts[0]
+ # See PEP 427 for the rules on escaping the project name
+ if "__" in name_part or re.match(r"^[\w\d._]*$", name_part, re.UNICODE) is
None:
+ raise InvalidWheelFilename("Invalid project name:
{0}".format(filename))
+ name = canonicalize_name(name_part)
+ version = Version(parts[1])
+ if dashes == 5:
+ build_part = parts[2]
+ build_match = _build_tag_regex.match(build_part)
+ if build_match is None:
+ raise InvalidWheelFilename(
+ "Invalid build number: {0} in '{1}'".format(build_part,
filename)
+ )
+ build = cast(BuildTag, (int(build_match.group(1)),
build_match.group(2)))
+ else:
+ build = ()
+ tags = parse_tag(parts[-1])
+ return (name, version, build, tags)
+
+
+def parse_sdist_filename(filename):
+ # type: (str) -> Tuple[NormalizedName, Version]
+ if not filename.endswith(".tar.gz"):
+ raise InvalidSdistFilename(
+ "Invalid sdist filename (extension must be '.tar.gz'):
{0}".format(filename)
+ )
+
+ # We are requiring a PEP 440 version, which cannot contain dashes,
+ # so we split on the last dash.
+ name_part, sep, version_part = filename[:-7].rpartition("-")
+ if not sep:
+ raise InvalidSdistFilename("Invalid sdist filename:
{0}".format(filename))
+
+ name = canonicalize_name(name_part)
+ version = Version(version_part)
+ return (name, version)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/packaging-20.8/packaging.egg-info/PKG-INFO
new/packaging-20.9/packaging.egg-info/PKG-INFO
--- old/packaging-20.8/packaging.egg-info/PKG-INFO 2020-12-12
05:35:40.000000000 +0100
+++ new/packaging-20.9/packaging.egg-info/PKG-INFO 2021-01-29
21:22:54.000000000 +0100
@@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: packaging
-Version: 20.8
+Version: 20.9
Summary: Core utilities for Python packages
Home-page: https://github.com/pypa/packaging
Author: Donald Stufft and individual contributors
@@ -83,6 +83,14 @@
Changelog
---------
+ 20.9 - 2021-01-29
+ ~~~~~~~~~~~~~~~~~
+
+ * Run [isort](https://pypi.org/project/isort/) over the code base
(`#377 <https://github.com/pypa/packaging/issues/377>`__)
+ * Add support for the ``macosx_10_*_universal2`` platform tags (`#379
<https://github.com/pypa/packaging/issues/379>`__)
+ * Introduce ``packaging.utils.parse_wheel_filename()`` and
``parse_sdist_filename()``
+ (`#387 <https://github.com/pypa/packaging/issues/387>`__ and `#389
<https://github.com/pypa/packaging/issues/389>`__)
+
20.8 - 2020-12-11
~~~~~~~~~~~~~~~~~
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/packaging-20.8/setup.cfg new/packaging-20.9/setup.cfg
--- old/packaging-20.8/setup.cfg 2020-12-12 05:35:40.409510900 +0100
+++ new/packaging-20.9/setup.cfg 2021-01-29 21:22:55.307393300 +0100
@@ -1,6 +1,10 @@
[bdist_wheel]
universal = 1
+[isort]
+profile = black
+combine_as_imports = true
+
[egg_info]
tag_build =
tag_date = 0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/packaging-20.8/tests/test_markers.py
new/packaging-20.9/tests/test_markers.py
--- old/packaging-20.8/tests/test_markers.py 2019-09-13 11:28:53.000000000
+0200
+++ new/packaging-20.9/tests/test_markers.py 2021-01-25 03:19:06.000000000
+0100
@@ -13,16 +13,15 @@
import pytest
from packaging.markers import (
- Node,
InvalidMarker,
+ Marker,
+ Node,
UndefinedComparison,
UndefinedEnvironmentName,
- Marker,
default_environment,
format_full_version,
)
-
VARIABLES = [
"extra",
"implementation_name",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/packaging-20.8/tests/test_requirements.py
new/packaging-20.9/tests/test_requirements.py
--- old/packaging-20.8/tests/test_requirements.py 2019-09-13
11:28:53.000000000 +0200
+++ new/packaging-20.9/tests/test_requirements.py 2021-01-25
03:19:06.000000000 +0100
@@ -6,8 +6,7 @@
import pytest
from packaging.markers import Marker
-from packaging.requirements import InvalidRequirement, Requirement, URL
-from packaging.requirements import URL_AND_MARKER
+from packaging.requirements import URL, URL_AND_MARKER, InvalidRequirement,
Requirement
from packaging.specifiers import SpecifierSet
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/packaging-20.8/tests/test_specifiers.py
new/packaging-20.9/tests/test_specifiers.py
--- old/packaging-20.8/tests/test_specifiers.py 2020-11-14 01:44:03.000000000
+0100
+++ new/packaging-20.9/tests/test_specifiers.py 2021-01-25 03:19:06.000000000
+0100
@@ -17,8 +17,7 @@
)
from packaging.version import LegacyVersion, Version, parse
-from .test_version import VERSIONS, LEGACY_VERSIONS
-
+from .test_version import LEGACY_VERSIONS, VERSIONS
LEGACY_SPECIFIERS = [
"==2.1.0.3",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/packaging-20.8/tests/test_tags.py
new/packaging-20.9/tests/test_tags.py
--- old/packaging-20.8/tests/test_tags.py 2020-12-12 00:44:41.000000000
+0100
+++ new/packaging-20.9/tests/test_tags.py 2021-01-25 03:19:06.000000000
+0100
@@ -12,7 +12,6 @@
except ImportError:
ctypes = None
import distutils.util
-
import os
import platform
import re
@@ -265,8 +264,14 @@
platform, "mac_ver", lambda: ("10.14", ("", "", ""), "x86_64")
)
version = platform.mac_ver()[0].split(".")
- expected = "macosx_{major}_{minor}".format(major=version[0],
minor=version[1])
+ if version[0] == "10":
+ expected = "macosx_{major}_{minor}".format(
+ major=version[0], minor=version[1]
+ )
+ else:
+ expected = "macosx_{major}_{minor}".format(major=version[0],
minor=0)
platforms = list(tags.mac_platforms(arch="x86_64"))
+ print(platforms, expected)
assert platforms[0].startswith(expected)
@pytest.mark.parametrize("arch", ["x86_64", "i386"])
@@ -312,6 +317,7 @@
# with the environment variable SYSTEM_VERSION_COMPAT=1.
assert "macosx_10_16_x86_64" in platforms
assert "macosx_10_15_x86_64" in platforms
+ assert "macosx_10_15_universal2" in platforms
assert "macosx_10_4_x86_64" in platforms
assert "macosx_10_3_x86_64" not in platforms
if major >= 12:
@@ -324,6 +330,7 @@
assert "macosx_11_3_arm64" not in platforms
assert "macosx_11_0_universal" not in platforms
assert "macosx_11_0_universal2" in platforms
+ assert "macosx_10_15_universal2" in platforms
assert "macosx_10_15_x86_64" not in platforms
assert "macosx_10_4_x86_64" not in platforms
assert "macosx_10_3_x86_64" not in platforms
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/packaging-20.8/tests/test_utils.py
new/packaging-20.9/tests/test_utils.py
--- old/packaging-20.8/tests/test_utils.py 2020-11-14 01:44:03.000000000
+0100
+++ new/packaging-20.9/tests/test_utils.py 2021-01-29 04:13:40.000000000
+0100
@@ -5,7 +5,15 @@
import pytest
-from packaging.utils import canonicalize_name, canonicalize_version
+from packaging.tags import Tag
+from packaging.utils import (
+ InvalidSdistFilename,
+ InvalidWheelFilename,
+ canonicalize_name,
+ canonicalize_version,
+ parse_sdist_filename,
+ parse_wheel_filename,
+)
from packaging.version import Version
@@ -47,3 +55,63 @@
)
def test_canonicalize_version(version, expected):
assert canonicalize_version(version) == expected
+
+
[email protected](
+ ("filename", "name", "version", "build", "tags"),
+ [
+ (
+ "foo-1.0-py3-none-any.whl",
+ "foo",
+ Version("1.0"),
+ (),
+ {Tag("py3", "none", "any")},
+ ),
+ (
+ "foo-1.0-1000-py3-none-any.whl",
+ "foo",
+ Version("1.0"),
+ (1000, ""),
+ {Tag("py3", "none", "any")},
+ ),
+ (
+ "foo-1.0-1000abc-py3-none-any.whl",
+ "foo",
+ Version("1.0"),
+ (1000, "abc"),
+ {Tag("py3", "none", "any")},
+ ),
+ ],
+)
+def test_parse_wheel_filename(filename, name, version, build, tags):
+ assert parse_wheel_filename(filename) == (name, version, build, tags)
+
+
[email protected](
+ ("filename"),
+ [
+ ("foo-1.0.whl"), # Missing tags
+ ("foo-1.0-py3-none-any.wheel"), # Incorrect file extension (`.wheel`)
+ ("foo__bar-1.0-py3-none-any.whl"), # Invalid name (`__`)
+ ("foo#bar-1.0-py3-none-any.whl"), # Invalid name (`#`)
+ # Build number doesn't start with a digit (`abc`)
+ ("foo-1.0-abc-py3-none-any.whl"),
+ ("foo-1.0-200-py3-none-any-junk.whl"), # Too many dashes (`-junk`)
+ ],
+)
+def test_parse_wheel_invalid_filename(filename):
+ with pytest.raises(InvalidWheelFilename):
+ parse_wheel_filename(filename)
+
+
[email protected](
+ ("filename", "name", "version"), [("foo-1.0.tar.gz", "foo",
Version("1.0"))]
+)
+def test_parse_sdist_filename(filename, name, version):
+ assert parse_sdist_filename(filename) == (name, version)
+
+
[email protected](("filename"), [("foo-1.0.zip"), ("foo1.0.tar.gz")])
+def test_parse_sdist_invalid_filename(filename):
+ with pytest.raises(InvalidSdistFilename):
+ parse_sdist_filename(filename)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/packaging-20.8/tests/test_version.py
new/packaging-20.9/tests/test_version.py
--- old/packaging-20.8/tests/test_version.py 2020-11-14 01:44:03.000000000
+0100
+++ new/packaging-20.9/tests/test_version.py 2021-01-25 03:19:06.000000000
+0100
@@ -10,7 +10,7 @@
import pretend
import pytest
-from packaging.version import Version, LegacyVersion, InvalidVersion, parse
+from packaging.version import InvalidVersion, LegacyVersion, Version, parse
@pytest.mark.parametrize(