forked from pool/python-async-lru
- 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
This commit is contained in:
23
.gitattributes
vendored
Normal file
23
.gitattributes
vendored
Normal file
@@ -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
|
||||
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
.osc
|
||||
3
async_lru-2.0.5.tar.gz
Normal file
3
async_lru-2.0.5.tar.gz
Normal file
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:481d52ccdd27275f42c43a928b4a50c3bfb2d67af4e78b170e3e0bb39c66e5bb
|
||||
size 10380
|
||||
33
python-async-lru.changes
Normal file
33
python-async-lru.changes
Normal file
@@ -0,0 +1,33 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Oct 31 01:17:05 UTC 2025 - Steve Kowalik <steven.kowalik@suse.com>
|
||||
|
||||
- Add patch support-python-314.patch:
|
||||
* Support Python 3.14 removals.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed May 14 09:27:21 UTC 2025 - John Paul Adrian Glaubitz <adrian.glaubitz@suse.com>
|
||||
|
||||
- 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 <dmueller@suse.com>
|
||||
|
||||
- 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 <dmueller@suse.com>
|
||||
|
||||
- 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 <code@bnavigator.de>
|
||||
|
||||
- Initial specfile for v2.0.2
|
||||
- Required by jupyterlab 4
|
||||
69
python-async-lru.spec
Normal file
69
python-async-lru.spec
Normal file
@@ -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
|
||||
125
support-python-314.patch
Normal file
125
support-python-314.patch
Normal file
@@ -0,0 +1,125 @@
|
||||
From c2a83bb41ca6ffd964854d0fe9c6014e5356ad2c Mon Sep 17 00:00:00 2001
|
||||
From: Lumir Balhar <lbalhar@redhat.com>
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user