From eabfbf7c81cba42f21e94296cc3466885d8494f04f4440cdaeaa83db5564d7bd Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Sun, 7 Nov 2021 11:12:09 +0000 Subject: [PATCH] OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-packaging?expand=0&rev=51 --- no-legacyversion-warning.patch | 34 ++++++++++++++++++++++++++++++++++ python-packaging.changes | 1 - python-packaging.spec | 7 +++++-- 3 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 no-legacyversion-warning.patch diff --git a/no-legacyversion-warning.patch b/no-legacyversion-warning.patch new file mode 100644 index 0000000..709c384 --- /dev/null +++ b/no-legacyversion-warning.patch @@ -0,0 +1,34 @@ +Index: packaging-21.2/packaging/specifiers.py +=================================================================== +--- packaging-21.2.orig/packaging/specifiers.py ++++ packaging-21.2/packaging/specifiers.py +@@ -270,12 +270,6 @@ class LegacySpecifier(_IndividualSpecifi + def __init__(self, spec: str = "", prereleases: Optional[bool] = None) -> None: + super().__init__(spec, prereleases) + +- warnings.warn( +- "Creating a LegacyVersion has been deprecated and will be " +- "removed in the next major release", +- DeprecationWarning, +- ) +- + def _coerce_version(self, version: UnparsedVersion) -> LegacyVersion: + if not isinstance(version, LegacyVersion): + version = LegacyVersion(str(version)) +Index: packaging-21.2/packaging/version.py +=================================================================== +--- packaging-21.2.orig/packaging/version.py ++++ packaging-21.2/packaging/version.py +@@ -108,12 +108,6 @@ class LegacyVersion(_BaseVersion): + self._version = str(version) + self._key = _legacy_cmpkey(self._version) + +- warnings.warn( +- "Creating a LegacyVersion has been deprecated and will be " +- "removed in the next major release", +- DeprecationWarning, +- ) +- + def __str__(self) -> str: + return self._version + diff --git a/python-packaging.changes b/python-packaging.changes index 63d7edb..86e8451 100644 --- a/python-packaging.changes +++ b/python-packaging.changes @@ -16,7 +16,6 @@ Sat Nov 6 18:30:50 UTC 2021 - Dirk Müller * Use typing alias ``UnparsedVersion`` * Improve type inference for ``packaging.specifiers.filter()`` * Tighten the return type of ``canonicalize_version()`` -- drop no-legacyversion-warning.patch: setuptools has been updated ------------------------------------------------------------------- Thu Jun 17 17:28:43 UTC 2021 - Ben Greiner diff --git a/python-packaging.spec b/python-packaging.spec index 8db1fbf..f7ff856 100644 --- a/python-packaging.spec +++ b/python-packaging.spec @@ -34,6 +34,8 @@ Summary: Core utilities for Python packages License: Apache-2.0 URL: https://github.com/pypa/packaging Source: https://files.pythonhosted.org/packages/source/p/packaging/packaging-%{version}.tar.gz +# Restore compatibility with 20.4 for setuptools +Patch1: no-legacyversion-warning.patch BuildRequires: %{python_module six} BuildRequires: fdupes BuildRequires: python-rpm-macros @@ -61,7 +63,7 @@ Provides: %{mypython}3dist(packaging) = %{version}-%{release} Core utilities for Python packages %prep -%setup -q -n packaging-%{version} +%autosetup -p1 -n packaging-%{version} # sdist must provide a packaging.egg-info, used below in install phase test -d packaging.egg-info @@ -70,7 +72,8 @@ test -d packaging.egg-info %if %{with test} %check -%pytest +# no-legacyversion-warning.patch causes these to fail +%pytest -k "not (test_legacy_specifier_is_deprecated or test_legacy_version_is_deprecated)" %endif # %%{with_test}