From 465e6654a126228d69b6056b25de53766df1ca3dca609f82ca2c8b401808e492 Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Mon, 6 Feb 2023 06:23:09 +0000 Subject: [PATCH] - Add patch support-packaging-22.patch: * Support packaging >= 22. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-pythonfinder?expand=0&rev=21 --- python-pythonfinder.changes | 6 ++++ python-pythonfinder.spec | 11 ++++--- support-packaging-22.patch | 66 +++++++++++++++++++++++++++++++++++++ 3 files changed, 78 insertions(+), 5 deletions(-) create mode 100644 support-packaging-22.patch diff --git a/python-pythonfinder.changes b/python-pythonfinder.changes index ee4922b..ea92132 100644 --- a/python-pythonfinder.changes +++ b/python-pythonfinder.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Mon Feb 6 06:22:28 UTC 2023 - Steve Kowalik + +- Add patch support-packaging-22.patch: + * Support packaging >= 22. + ------------------------------------------------------------------- Mon Dec 12 17:40:21 UTC 2022 - pgajdos@suse.com diff --git a/python-pythonfinder.spec b/python-pythonfinder.spec index 53864b5..235fec3 100644 --- a/python-pythonfinder.spec +++ b/python-pythonfinder.spec @@ -1,7 +1,7 @@ # # spec file for package python-pythonfinder # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -21,16 +21,17 @@ Version: 1.3.1 Release: 0 Summary: A tool to locate Python on the system License: MIT -Group: Development/Languages/Python URL: https://github.com/sarugaku/pythonfinder Source: https://github.com/sarugaku/pythonfinder/archive/refs/tags/v%{version}.tar.gz#/pythonfinder-%{version}.tar.gz +# PATCH-FIX-UPSTREAM gh#sarugaku/pythonfinder#127 +Patch0: support-packaging-22.patch BuildRequires: %{python_module setuptools >= 36.2.2} BuildRequires: fdupes BuildRequires: python-rpm-macros Requires: python-attrs Requires: python-cached-property Requires: python-click -Requires: python-packaging +Requires: python-packaging >= 22.0 Requires: python-vistir >= 0.2.5 Requires(post): update-alternatives Requires(postun):update-alternatives @@ -40,7 +41,7 @@ BuildRequires: %{python_module attrs} BuildRequires: %{python_module cached-property} BuildRequires: %{python_module click} BuildRequires: %{python_module crayons} -BuildRequires: %{python_module packaging} +BuildRequires: %{python_module packaging >= 22.0} BuildRequires: %{python_module pytest} BuildRequires: %{python_module vistir >= 0.2.5} # /SECTION @@ -50,7 +51,7 @@ BuildRequires: %{python_module vistir >= 0.2.5} A Python discovery tool to locate Python on the system. %prep -%setup -q -n pythonfinder-%{version} +%autosetup -p1 -n pythonfinder-%{version} rm -r tasks sed -i '/addopts/d' setup.cfg diff --git a/support-packaging-22.patch b/support-packaging-22.patch new file mode 100644 index 0000000..df3b1b8 --- /dev/null +++ b/support-packaging-22.patch @@ -0,0 +1,66 @@ +From a8a74b076c43c9fc5af7e52f7fc9cd2bd394bd0f Mon Sep 17 00:00:00 2001 +From: finswimmer +Date: Wed, 21 Dec 2022 12:04:47 +0100 +Subject: [PATCH 1/2] fix: catch InvalidVersion instead of handling + LegacyVersion + +LegacyVersion was removed from packaging in version 22.0 +--- + src/pythonfinder/utils.py | 11 +++++++---- + 1 file changed, 7 insertions(+), 4 deletions(-) + +diff --git a/src/pythonfinder/utils.py b/src/pythonfinder/utils.py +index 4330e17..2b28c2f 100644 +--- a/src/pythonfinder/utils.py ++++ b/src/pythonfinder/utils.py +@@ -9,7 +9,7 @@ + from threading import Timer + + import attr +-from packaging.version import LegacyVersion, Version ++from packaging.version import Version, InvalidVersion + + from .compat import Path, TimeoutError, lru_cache # noqa + from .environment import MYPY_RUNNING, PYENV_ROOT, SUBPROCESS_TIMEOUT +@@ -130,12 +130,15 @@ def parse_python_version(version_str): + is_devrelease = True if version_dict.get("dev") else False + if patch: + patch = int(patch) +- version = None # type: Optional[Union[Version, LegacyVersion]] ++ ++ version = None # type: Optional[Version] ++ + try: + version = parse_version(version_str) +- except TypeError: ++ except (TypeError, InvalidVersion): + version = None +- if isinstance(version, LegacyVersion) or version is None: ++ ++ if version is None: + v_dict = version_dict.copy() + pre = "" + if v_dict.get("prerel") and v_dict.get("prerelversion"): + +From e9ff2792712615965b793b6b4cc26c28f88cdb2c Mon Sep 17 00:00:00 2001 +From: finswimmer +Date: Wed, 21 Dec 2022 12:12:28 +0100 +Subject: [PATCH 2/2] chore: set minimum required packaging version to 22.0 + +--- + setup.cfg | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/setup.cfg b/setup.cfg +index 9d615bf..fb83de1 100644 +--- a/setup.cfg ++++ b/setup.cfg +@@ -39,7 +39,7 @@ package_data = + install_requires = + attrs + cached-property +- packaging ++ packaging>=22.0 + + [options.packages.find] + where = src