forked from pool/python-cached-property
Accepting request 1064307 from home:mcepl:branches:dirk-acdc
- Refresh patches and remove weird replacement of conftest.py command in %%prep. OBS-URL: https://build.opensuse.org/request/show/1064307 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-cached-property?expand=0&rev=22
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
Index: cached-property-1.5.1/tests/test_cached_property.py
|
||||
===================================================================
|
||||
--- cached-property-1.5.1.orig/tests/test_cached_property.py
|
||||
+++ cached-property-1.5.1/tests/test_cached_property.py
|
||||
@@ -191,6 +191,7 @@
|
||||
---
|
||||
tests/test_cached_property.py | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
--- a/tests/test_cached_property.py
|
||||
+++ b/tests/test_cached_property.py
|
||||
@@ -188,6 +188,7 @@ class TestCachedPropertyWithTTL(TestCach
|
||||
self.assert_cached(check, 2)
|
||||
self.assert_cached(check, 2)
|
||||
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Feb 10 16:40:47 UTC 2023 - Matej Cepl <mcepl@suse.com>
|
||||
|
||||
- Refresh patches and remove weird replacement of conftest.py
|
||||
command in %%prep.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Jan 31 23:18:09 UTC 2023 - Dirk Müller <dmueller@suse.com>
|
||||
|
||||
|
||||
@@ -45,7 +45,6 @@ and 3.
|
||||
|
||||
%prep
|
||||
%autosetup -p1 -n cached-property-%{version}
|
||||
printf 'import sys\nif sys.version_info < (3, 0): collect_ignore = ["tests/test_async_cached_property.py", "tests/test_coroutine_cached_property.py"]' > conftest.py
|
||||
|
||||
%build
|
||||
%python_build
|
||||
|
||||
@@ -19,29 +19,27 @@ 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(-)
|
||||
cached_property.py | 24 +++++++++++-------------
|
||||
conftest.py | 8 ++++----
|
||||
tests/test_async_cached_property.py | 3 +--
|
||||
3 files changed, 16 insertions(+), 19 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 @@
|
||||
@@ -13,6 +13,12 @@ try:
|
||||
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):
|
||||
@@ -30,22 +36,14 @@ def __get__(self, obj, cls):
|
||||
@@ -30,22 +36,14 @@ class cached_property(object):
|
||||
if obj is None:
|
||||
return self
|
||||
|
||||
@@ -69,21 +67,23 @@ index 3135871..254739c 100644
|
||||
|
||||
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 @@
|
||||
@@ -1,4 +1,3 @@
|
||||
-
|
||||
import sys
|
||||
|
||||
# Whether "import asyncio" works
|
||||
@@ -7,13 +6,14 @@ has_asyncio = sys.version_info[0] == 3 a
|
||||
# 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)
|
||||
+dropped_asyncio_coroutine = sys.version_info[0] == 3 and sys.version_info[1] >= 11
|
||||
|
||||
-print("conftest.py", has_asyncio, has_async_await)
|
||||
-
|
||||
+print("conftest.py", has_asyncio, has_async_await, dropped_asyncio_coroutine)
|
||||
|
||||
collect_ignore = []
|
||||
|
||||
@@ -92,11 +92,9 @@ index 0563f64..1c4b618 100644
|
||||
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 @@
|
||||
@@ -9,8 +9,7 @@ import cached_property
|
||||
|
||||
def unittest_run_loop(f):
|
||||
def wrapper(*args, **kwargs):
|
||||
@@ -106,37 +104,3 @@ index 4ba84f3..d61cc28 100644
|
||||
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):
|
||||
|
||||
Reference in New Issue
Block a user