import python-cached_property-1.5.2-7.el9

i9ce changed/i9ce/python-cached_property-1.5.2-7.el9
Sergey Cherevko 6 months ago
commit f6a97381d5
Signed by: scherevko
GPG Key ID: D87CBBC16D2E4A72

1
.gitignore vendored

@ -0,0 +1 @@
SOURCES/cached-property-1.5.2.tar.gz

@ -0,0 +1 @@
8501f7a67f01cd3694c2419d2a56247e6d5757af SOURCES/cached-property-1.5.2.tar.gz

@ -0,0 +1,39 @@
From ae6bb7d68ec4a75528e71b4bd12261d6994aebaa Mon Sep 17 00:00:00 2001
From: Adam Williamson <awilliam@redhat.com>
Date: Mon, 11 Feb 2019 16:15:31 -0800
Subject: [PATCH] Disable checks broken with freezegun 0.3.11 (#131)
A couple of checks in the test fail with freezegun 0.3.11. This
is a test issue not a bug in the normal functionality of the
software, and there's no working fix I can find yet, so let's
disable these checks until it's resolved.
Signed-off-by: Adam Williamson <awilliam@redhat.com>
---
tests/test_cached_property.py | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tests/test_cached_property.py b/tests/test_cached_property.py
index 5082416..b8b74de 100644
--- a/tests/test_cached_property.py
+++ b/tests/test_cached_property.py
@@ -201,12 +201,12 @@ class TestCachedPropertyWithTTL(TestCachedProperty):
# The cache expires in the future
with freeze_time("9999-01-01"):
check.run_threads(num_threads)
- self.assert_cached(check, 2 * num_threads)
- self.assert_cached(check, 2 * num_threads)
+# self.assert_cached(check, 2 * num_threads)
+# self.assert_cached(check, 2 * num_threads)
# Things are not reverted when we are back to the present
- self.assert_cached(check, 2 * num_threads)
- self.assert_cached(check, 2 * num_threads)
+# self.assert_cached(check, 2 * num_threads)
+# self.assert_cached(check, 2 * num_threads)
class TestThreadedCachedPropertyWithTTL(
--
2.20.1

@ -0,0 +1,142 @@
From 297031687679762849dedeaf24aa3a19116f095b Mon Sep 17 00:00:00 2001
From: Petr Viktorin <encukou@gmail.com>
Date: Thu, 2 Dec 2021 11:26:20 +0100
Subject: [PATCH 1/2] Don't use asyncio.coroutinefunction if it's not available
Python 3.11 drops the deprecated @asyncio.coroutine and
asyncio.iscoroutinefunction.
Using a wrapper with @asyncio.coroutine in __get__ wasn't
necessary (the future from asyncio.ensure_future is awaitable,
and the wrapper doesn't do anything asynchronous), so the
logic can be simplified to just call asyncio.ensure_future
(to schedule the task and store the result when it's
available).
Tests for @asyncio.coroutine are skipped on 3.11+.
An unnecessary call to asyncio.coroutine in tests is
removed: it's not necessary to call this for `async def`
functions.
---
cached_property.py | 24 +++++++++++-------------
conftest.py | 6 +++++-
tests/test_async_cached_property.py | 3 +--
3 files changed, 17 insertions(+), 16 deletions(-)
diff --git a/cached_property.py b/cached_property.py
index 3135871..254739c 100644
--- a/cached_property.py
+++ b/cached_property.py
@@ -13,6 +13,12 @@
import asyncio
except (ImportError, SyntaxError):
asyncio = None
+try:
+ iscoroutinefunction = asyncio.iscoroutinefunction
+except AttributeError:
+ # Python 3.11: @asyncio.coroutine was removed
+ from inspect import iscoroutinefunction
+
class cached_property(object):
@@ -30,22 +36,14 @@ def __get__(self, obj, cls):
if obj is None:
return self
- if asyncio and asyncio.iscoroutinefunction(self.func):
- return self._wrap_in_coroutine(obj)
+ if asyncio and iscoroutinefunction(self.func):
+ value = asyncio.ensure_future(self.func(obj))
+ else:
+ value = self.func(obj)
- value = obj.__dict__[self.func.__name__] = self.func(obj)
+ obj.__dict__[self.func.__name__] = value
return value
- def _wrap_in_coroutine(self, obj):
- @wraps(obj)
- @asyncio.coroutine
- def wrapper():
- future = asyncio.ensure_future(self.func(obj))
- obj.__dict__[self.func.__name__] = future
- return future
-
- return wrapper()
-
class threaded_cached_property(object):
"""
diff --git a/conftest.py b/conftest.py
index 0563f64..1c4b618 100644
--- a/conftest.py
+++ b/conftest.py
@@ -7,13 +7,17 @@
# Whether the async and await keywords work
has_async_await = sys.version_info[0] == 3 and sys.version_info[1] >= 5
+# Whether "from asyncio import coroutine" *fails*
+version_info = sys.version_info
+dropped_asyncio_coroutine = version_info[0] == 3 and version_info[1] >= 11
+
print("conftest.py", has_asyncio, has_async_await)
collect_ignore = []
-if not has_asyncio:
+if not has_asyncio or dropped_asyncio_coroutine:
collect_ignore.append("tests/test_coroutine_cached_property.py")
if not has_async_await:
diff --git a/tests/test_async_cached_property.py b/tests/test_async_cached_property.py
index 4ba84f3..d61cc28 100644
--- a/tests/test_async_cached_property.py
+++ b/tests/test_async_cached_property.py
@@ -9,8 +9,7 @@
def unittest_run_loop(f):
def wrapper(*args, **kwargs):
- coro = asyncio.coroutine(f)
- future = coro(*args, **kwargs)
+ future = f(*args, **kwargs)
loop = asyncio.get_event_loop()
loop.run_until_complete(future)
From 9b210d12fa73c91743378ba4a966417846e7ea9a Mon Sep 17 00:00:00 2001
From: Petr Viktorin <encukou@gmail.com>
Date: Thu, 2 Dec 2021 11:44:18 +0100
Subject: [PATCH 2/2] Restore compatibility with python 2.7
This is still necessary according to the Contributing Guidelines.
---
cached_property.py | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/cached_property.py b/cached_property.py
index 254739c..944e2f5 100644
--- a/cached_property.py
+++ b/cached_property.py
@@ -13,12 +13,12 @@
import asyncio
except (ImportError, SyntaxError):
asyncio = None
-try:
- iscoroutinefunction = asyncio.iscoroutinefunction
-except AttributeError:
- # Python 3.11: @asyncio.coroutine was removed
- from inspect import iscoroutinefunction
-
+if asyncio:
+ try:
+ iscoroutinefunction = asyncio.iscoroutinefunction
+ except AttributeError:
+ # Python 3.11: @asyncio.coroutine was removed
+ from inspect import iscoroutinefunction
class cached_property(object):

@ -0,0 +1,181 @@
%global projectname cached-property
%global modulename cached_property
Name: python-%{modulename}
Version: 1.5.2
Release: 7%{?dist}
Summary: A cached-property for decorating methods in Python classes
License: BSD
URL: https://github.com/pydanny/%{projectname}
Source0: https://github.com/pydanny/%{projectname}/archive/%{version}/%{projectname}-%{version}.tar.gz
# Disable a couple of test checks that fail with freezegun 0.3.11
# See https://github.com/pydanny/cached-property/issues/131
Patch0: 0001-Disable-checks-broken-with-freezegun-0.3.11-131.patch
# Fix for removal of asyncio.coroutine in Python 3.11
# https://github.com/pydanny/cached-property/pull/267
Patch1: 267.patch
BuildArch: noarch
%description
cached_property allows properties in Python classes to be cached until the cache
is invalidated or expired.
%package -n python%{python3_pkgversion}-%{modulename}
Summary: A cached-property for decorating methods in Python classes.
BuildRequires: python%{python3_pkgversion}-devel
BuildRequires: python%{python3_pkgversion}-setuptools
BuildRequires: python%{python3_pkgversion}-dateutil
BuildRequires: python%{python3_pkgversion}-freezegun
BuildRequires: python%{python3_pkgversion}-pytest
%{?python_provide:%python_provide python%{python3_pkgversion}-%{modulename}}
# This package was python3-{projectname} for a long time, but never should've
# been
Provides: python%{python3_pkgversion}-%{projectname} = %{version}-%{release}
Obsoletes: python%{python3_pkgversion}-%{projectname} < 1.3.0-2
%description -n python%{python3_pkgversion}-%{modulename}
cached_property allows properties in Python classes to be cached until the cache
is invalidated or expired.
%prep
%autosetup -p1 -n %{projectname}-%{version}
%build
%{__python3} setup.py build
%install
%{__python3} setup.py install -O1 --skip-build --root %{buildroot}
%check
PYTHONPATH=./ py.test-3
%files -n python%{python3_pkgversion}-%{modulename}
%doc AUTHORS.rst HISTORY.rst CONTRIBUTING.rst README.rst
%license LICENSE
%{python3_sitelib}/%{modulename}*
%{python3_sitelib}/__pycache__/%{modulename}*
%changelog
* Sun Jul 28 2024 Sergey Cherevko <s.cherevko@msvsphere-os.ru> - 1.5.2-7
- Rebuilt for MSVSphere 9.4
* Mon Jun 13 2022 Python Maint <python-maint@redhat.com> - 1.5.2-7
- Rebuilt for Python 3.11
* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.2-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
* Thu Dec 02 2021 Adam Williamson <awilliam@redhat.com> - 1.5.2-5
- Backport PR #267 to fix compatibility with Python 3.11 (thanks Petr Viktorin)
* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.2-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild
* Fri Jun 04 2021 Python Maint <python-maint@redhat.com> - 1.5.2-3
- Rebuilt for Python 3.10
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
* Wed Jan 13 16:02:58 CET 2021 Petr Viktorin <pviktori@redhat.com> - 1.5.2-1
- Update to 1.5.2
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.1-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
* Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 1.5.1-8
- Rebuilt for Python 3.9
* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.1-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
* Thu Oct 03 2019 Miro Hrončok <mhroncok@redhat.com> - 1.5.1-6
- Rebuilt for Python 3.8.0rc1 (#1748018)
* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 1.5.1-5
- Rebuilt for Python 3.8
* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
* Mon Feb 11 2019 Adam Williamson <awilliam@redhat.com> - 1.5.1-3
- Disable a couple of test checks that fail with freezegun 0.3.11
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
* Fri Nov 23 2018 Adam Williamson <awilliam@redhat.com> - 1.5.1-1
- New release 1.5.1
- Disable Python 2 build on F30+, EL8+
* Fri Nov 23 2018 Miro Hrončok <mhroncok@redhat.com> - 1.4.3-1
- Update to 1.4.3 (used by pipenv)
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.0-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 1.3.0-12
- Rebuilt for Python 3.7
* Sun Feb 11 2018 Iryna Shcherbina <ishcherb@redhat.com> - 1.3.0-11
- Update Python 2 dependency declarations to new packaging standards
(See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.0-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.0-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.0-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
* Fri Feb 10 2017 Adam Williamson <awilliam@redhat.com> - 1.3.0-7
- Enable Python 3 build on EPEL 7
* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 1.3.0-6
- Rebuild for Python 3.6
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.3.0-5
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
* Thu Mar 03 2016 Adam Williamson <awilliam@redhat.com> - 1.3.0-4
- disable tests on F22 (it doesn't know about py3.5)
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.3.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Wed Dec 09 2015 Adam Williamson <awilliam@redhat.com> - 1.3.0-2
- try to repair the mess I made of package naming:
- # both subpackages now use module name not project name
- # try to ensure all previous names are provided/obsoleted
* Thu Nov 26 2015 Adam Williamson <awilliam@redhat.com> - 1.3.0-1
- new release 1.3.0, drop patch (merged upstream)
- switch to python2-foo / python3-foo package naming
* Tue Nov 10 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.0-3
- Rebuilt for https://fedoraproject.org/wiki/Changes/python3.5
* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Wed Apr 29 2015 Adam Williamson <awilliam@redhat.com> - 1.2.0-1
- new upstream release 1.2.0 (refactoring, bug fixes)
- patch out non-ASCII characters in HISTORY.rst (breaks py3 build in koji)
* Thu Apr 16 2015 Adam Williamson <awilliam@redhat.com> - 1.1.0-1
- new upstream release 1.1.0 (insignificant changes)
* Wed Mar 25 2015 Adam Williamson <awilliam@redhat.com> - 1.0.0-4
- python3 build only for Fedora (no python3 in RHEL6 or 7)
- provide python2-cached_property
- guard against #license not being available
- only run tests on F>=22 (tox is too old on everything else)
* Fri Mar 13 2015 Pete Travis <me@petetravis.com> - 1.0.0-2
- Use the module name for the package name.
* Fri Feb 20 2015 Pete Travis <me@petetravis.com> 1.0.0-1
- Initial packaging.
Loading…
Cancel
Save