14
0

Accepting request 1063357 from devel:languages:python

- Add patch support-packaging-22.patch:
  * Support packaging >= 22.

OBS-URL: https://build.opensuse.org/request/show/1063357
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-pythonfinder?expand=0&rev=10
This commit is contained in:
2023-02-06 13:15:35 +00:00
committed by Git OBS Bridge
3 changed files with 78 additions and 5 deletions

View File

@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Mon Feb 6 06:22:28 UTC 2023 - Steve Kowalik <steven.kowalik@suse.com>
- Add patch support-packaging-22.patch:
* Support packaging >= 22.
-------------------------------------------------------------------
Mon Dec 12 17:40:21 UTC 2022 - pgajdos@suse.com

View File

@@ -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

View File

@@ -0,0 +1,66 @@
From a8a74b076c43c9fc5af7e52f7fc9cd2bd394bd0f Mon Sep 17 00:00:00 2001
From: finswimmer <finswimmer77@gmail.com>
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 <finswimmer77@gmail.com>
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