From 0a6261a840ebd58d5a6eaf521be67ff9bbd7d8242834bfd0f87bd5efead16725 Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Fri, 31 Oct 2025 01:17:44 +0000 Subject: [PATCH] - Add patch support-python-314.patch: * Support Python 3.14 removals. OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-async-lru?expand=0&rev=10 --- .gitattributes | 23 +++++++ .gitignore | 1 + async_lru-2.0.5.tar.gz | 3 + python-async-lru.changes | 33 +++++++++++ python-async-lru.spec | 69 +++++++++++++++++++++ support-python-314.patch | 125 +++++++++++++++++++++++++++++++++++++++ 6 files changed, 254 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 async_lru-2.0.5.tar.gz create mode 100644 python-async-lru.changes create mode 100644 python-async-lru.spec create mode 100644 support-python-314.patch diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/async_lru-2.0.5.tar.gz b/async_lru-2.0.5.tar.gz new file mode 100644 index 0000000..1b67413 --- /dev/null +++ b/async_lru-2.0.5.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:481d52ccdd27275f42c43a928b4a50c3bfb2d67af4e78b170e3e0bb39c66e5bb +size 10380 diff --git a/python-async-lru.changes b/python-async-lru.changes new file mode 100644 index 0000000..7b041c6 --- /dev/null +++ b/python-async-lru.changes @@ -0,0 +1,33 @@ +------------------------------------------------------------------- +Fri Oct 31 01:17:05 UTC 2025 - Steve Kowalik + +- Add patch support-python-314.patch: + * Support Python 3.14 removals. + +------------------------------------------------------------------- +Wed May 14 09:27:21 UTC 2025 - John Paul Adrian Glaubitz + +- Update to 2.0.5 + * Fixed a memory leak on exceptions and minor performance improvement. +- Adjust upstream source name in spec file + +------------------------------------------------------------------- +Sat Jul 29 09:02:08 UTC 2023 - Dirk Müller + +- update to 2.0.4: + * Fixed an error when there are pending tasks while calling + ``.cache_clear()``. + +------------------------------------------------------------------- +Sun Jul 16 10:56:19 UTC 2023 - Dirk Müller + +- update to 2.0.3: + * Fixed a ``KeyError`` that could occur when using ``ttl`` with + ``maxsize``. + * Dropped ``typing-extensions`` dependency in Python 3.11+. + +------------------------------------------------------------------- +Sun Jun 11 21:36:58 UTC 2023 - Ben Greiner + +- Initial specfile for v2.0.2 +- Required by jupyterlab 4 diff --git a/python-async-lru.spec b/python-async-lru.spec new file mode 100644 index 0000000..9e84fe7 --- /dev/null +++ b/python-async-lru.spec @@ -0,0 +1,69 @@ +# +# spec file for package python-async-lru +# +# Copyright (c) 2025 SUSE LLC and contributors +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +%{?sle15_python_module_pythons} +Name: python-async-lru +Version: 2.0.5 +Release: 0 +Summary: Simple LRU cache for asyncio +License: MIT +URL: https://github.com/aio-libs/async-lru +Source: https://files.pythonhosted.org/packages/source/a/async_lru/async_lru-%{version}.tar.gz +# PATCH-FIX-UPSTREAM Based on gh#aio-libs/async-lru#637 +Patch0: support-python-314.patch +BuildRequires: %{python_module pip} +BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module wheel} +BuildRequires: fdupes +BuildRequires: python-rpm-macros +Provides: python-async_lru = %{version}-%{release} +BuildArch: noarch +# SECTION test requirements +BuildRequires: %{python_module pytest-asyncio} +BuildRequires: %{python_module pytest-timeout} +BuildRequires: %{python_module pytest} +# /SECTION +%python_subpackages + +%description +This package is a port of Python's built-in functools.lru_cache function for asyncio. +To better handle async behaviour, it also ensures multiple concurrent calls will only +result in 1 call to the wrapped function, with all awaits receiving the result of that +call when it completes. + +%prep +%autosetup -p1 -n async_lru-%{version} +sed -i /addopts/d setup.cfg + +%build +%pyproject_wheel + +%install +%pyproject_install +%python_expand %fdupes %{buildroot}%{$python_sitelib} + +%check +%pytest + +%files %{python_files} +%doc README.rst +%license LICENSE +%{python_sitelib}/async_lru +%{python_sitelib}/async_lru-%{version}.dist-info + +%changelog diff --git a/support-python-314.patch b/support-python-314.patch new file mode 100644 index 0000000..f0c1a30 --- /dev/null +++ b/support-python-314.patch @@ -0,0 +1,125 @@ +From c2a83bb41ca6ffd964854d0fe9c6014e5356ad2c Mon Sep 17 00:00:00 2001 +From: Lumir Balhar +Date: Fri, 17 Jan 2025 14:57:03 +0100 +Subject: [PATCH 01/20] Switch from asyncio.iscoroutinefunction to inspect for + Py 3.14+. + +The former causes: DeprecationWarning: +'asyncio.iscoroutinefunction' is deprecated and slated for removal +in Python 3.16; use inspect.iscoroutinefunction() instead. + +Fixes: https://github.com/aio-libs/async-lru/issues/635 +--- + async_lru/__init__.py | 8 +++++++- + tests/test_basic.py | 9 +++++---- + 2 files changed, 12 insertions(+), 5 deletions(-) + +Index: async_lru-2.0.5/async_lru/__init__.py +=================================================================== +--- async_lru-2.0.5.orig/async_lru/__init__.py ++++ async_lru-2.0.5/async_lru/__init__.py +@@ -1,7 +1,7 @@ + import asyncio + import dataclasses ++import inspect + import sys +-from asyncio.coroutines import _is_coroutine # type: ignore[attr-defined] + from functools import _CacheInfo, _make_key, partial, partialmethod + from typing import ( + Any, +@@ -27,6 +27,9 @@ if sys.version_info >= (3, 11): + else: + from typing_extensions import Self + ++if sys.version_info < (3, 14): ++ from asyncio.coroutines import _is_coroutine # type: ignore[attr-defined] ++ + + __version__ = "2.0.5" + +@@ -95,7 +98,8 @@ class _LRUCacheWrapper(Generic[_R]): + pass + # set __wrapped__ last so we don't inadvertently copy it + # from the wrapped function when updating __dict__ +- self._is_coroutine = _is_coroutine ++ if sys.version_info < (3, 14): ++ self._is_coroutine = _is_coroutine + self.__wrapped__ = fn + self.__maxsize = maxsize + self.__typed = typed +@@ -262,7 +266,8 @@ class _LRUCacheWrapperInstanceMethod(Gen + pass + # set __wrapped__ last so we don't inadvertently copy it + # from the wrapped function when updating __dict__ +- self._is_coroutine = _is_coroutine ++ if sys.version_info < (3, 14): ++ self._is_coroutine = _is_coroutine + self.__wrapped__ = wrapper.__wrapped__ + self.__instance = instance + self.__wrapper = wrapper +@@ -299,14 +304,17 @@ def _make_wrapper( + while isinstance(origin, (partial, partialmethod)): + origin = origin.func + +- if not asyncio.iscoroutinefunction(origin): ++ if not inspect.iscoroutinefunction(origin): + raise RuntimeError(f"Coroutine function is required, got {fn!r}") + + # functools.partialmethod support + if hasattr(fn, "_make_unbound_method"): + fn = fn._make_unbound_method() + +- return _LRUCacheWrapper(cast(_CB[_R], fn), maxsize, typed, ttl) ++ wrapper = _LRUCacheWrapper(cast(_CB[_R], fn), maxsize, typed, ttl) ++ if sys.version_info >= (3, 12): ++ wrapper = inspect.markcoroutinefunction(wrapper) ++ return wrapper + + return wrapper + +Index: async_lru-2.0.5/tests/test_basic.py +=================================================================== +--- async_lru-2.0.5.orig/tests/test_basic.py ++++ async_lru-2.0.5/tests/test_basic.py +@@ -1,4 +1,5 @@ + import asyncio ++import inspect + import platform + import sys + from functools import _CacheInfo, partial +@@ -27,7 +28,10 @@ async def test_alru_cache_deco(check_lru + async def coro() -> None: + pass + +- assert asyncio.iscoroutinefunction(coro) ++ if sys.version_info >= (3, 12): ++ assert inspect.iscoroutinefunction(coro) ++ if sys.version_info < (3, 14): ++ assert asyncio.iscoroutinefunction(coro) + + check_lru(coro, hits=0, misses=0, cache=0, tasks=0) + +@@ -41,7 +45,10 @@ async def test_alru_cache_deco_called(ch + async def coro() -> None: + pass + +- assert asyncio.iscoroutinefunction(coro) ++ if sys.version_info >= (3, 12): ++ assert inspect.iscoroutinefunction(coro) ++ if sys.version_info < (3, 14): ++ assert asyncio.iscoroutinefunction(coro) + + check_lru(coro, hits=0, misses=0, cache=0, tasks=0) + +@@ -56,7 +63,10 @@ async def test_alru_cache_fn_called(chec + + coro_wrapped = alru_cache(coro) + +- assert asyncio.iscoroutinefunction(coro_wrapped) ++ if sys.version_info >= (3, 12): ++ assert inspect.iscoroutinefunction(coro_wrapped) ++ if sys.version_info < (3, 14): ++ assert asyncio.iscoroutinefunction(coro) + + check_lru(coro_wrapped, hits=0, misses=0, cache=0, tasks=0) +