Github messages for voidlinux
 help / color / mirror / Atom feed
* [PR PATCH] python3-cached-property: update to 1.5.2.
@ 2022-06-12  4:25 pfpulux
  2022-06-14 15:53 ` [PR REVIEW] " sgn
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: pfpulux @ 2022-06-12  4:25 UTC (permalink / raw)
  To: ml

[-- Attachment #1: Type: text/plain, Size: 1263 bytes --]

There is a new pull request by pfpulux against master on the void-packages repository

https://github.com/pfpulux/void-packages python3-cached-property
https://github.com/void-linux/void-packages/pull/37526

python3-cached-property: update to 1.5.2.
<!-- Uncomment relevant sections and delete options which are not applicable -->

#### Testing the changes
- I tested the changes in this PR: **YES**

<!--
#### New package
- This new package conforms to the [quality requirements](https://github.com/void-linux/void-packages/blob/master/Manual.md#quality-requirements): **YES**|**NO**
-->

<!-- Note: If the build is likely to take more than 2 hours, please add ci skip tag as described in
https://github.com/void-linux/void-packages/blob/master/CONTRIBUTING.md#continuous-integration
and test at least one native build and, if supported, at least one cross build.
Ignore this section if this PR is not skipping CI.
-->
<!--
#### Local build testing
- I built this PR locally for my native architecture, (ARCH-LIBC)
- I built this PR locally for these architectures (if supported. mark crossbuilds):
  - aarch64-musl
  - armv7l
  - armv6l-musl
-->


A patch file from https://github.com/void-linux/void-packages/pull/37526.patch is attached

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: github-pr-python3-cached-property-37526.patch --]
[-- Type: text/x-diff, Size: 5315 bytes --]

From 9e295e51b040aa074b614412f653f0acda97a19e Mon Sep 17 00:00:00 2001
From: Pulux <pulux@pf4sh.eu>
Date: Sun, 12 Jun 2022 06:15:54 +0200
Subject: [PATCH] python3-cached-property: update to 1.5.2.

---
 .../patches/p267.patch                        | 101 ++++++++++++++++++
 srcpkgs/python3-cached-property/template      |   9 +-
 2 files changed, 106 insertions(+), 4 deletions(-)
 create mode 100644 srcpkgs/python3-cached-property/patches/p267.patch

diff --git a/srcpkgs/python3-cached-property/patches/p267.patch b/srcpkgs/python3-cached-property/patches/p267.patch
new file mode 100644
index 000000000000..0f4afe2765cc
--- /dev/null
+++ b/srcpkgs/python3-cached-property/patches/p267.patch
@@ -0,0 +1,101 @@
+diff --git a/cached_property.py b/cached_property.py
+index 3135871..182d164 100644
+--- a/cached_property.py
++++ b/cached_property.py
+@@ -13,6 +13,8 @@ try:
+     import asyncio
+ except (ImportError, SyntaxError):
+     asyncio = None
++if asyncio:
++    from inspect import iscoroutinefunction
+ 
+ 
+ class cached_property(object):
+@@ -30,22 +32,14 @@ class cached_property(object):
+         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..1141424 100644
+--- a/conftest.py
++++ b/conftest.py
+@@ -7,13 +7,17 @@ has_asyncio = sys.version_info[0] == 3 and sys.version_info[1] >= 4
+ # 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] >= 10
++
+ 
+ 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..d4157e1 100644
+--- a/tests/test_async_cached_property.py
++++ b/tests/test_async_cached_property.py
+@@ -9,9 +9,8 @@ import cached_property
+ 
+ def unittest_run_loop(f):
+     def wrapper(*args, **kwargs):
+-        coro = asyncio.coroutine(f)
+-        future = coro(*args, **kwargs)
+-        loop = asyncio.get_event_loop()
++        future = f(*args, **kwargs)
++        loop = asyncio.new_event_loop()
+         loop.run_until_complete(future)
+ 
+     return wrapper
+diff --git a/tests/test_cached_property.py b/tests/test_cached_property.py
+index 5082416..8ac6e48 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, num_threads + 1)
++            # 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, num_threads + 1)
++        # self.assert_cached(check, 2 * num_threads)
+ 
+ 
+ class TestThreadedCachedPropertyWithTTL(
diff --git a/srcpkgs/python3-cached-property/template b/srcpkgs/python3-cached-property/template
index 7d088f3cd023..504488a6daeb 100644
--- a/srcpkgs/python3-cached-property/template
+++ b/srcpkgs/python3-cached-property/template
@@ -1,17 +1,18 @@
 # Template file for 'python3-cached-property'
 pkgname=python3-cached-property
-version=1.5.1
-revision=5
+version=1.5.2
+revision=1
 wrksrc="cached-property-${version}"
 build_style=python3-module
 hostmakedepends="python3-setuptools"
 depends="python3"
+checkdepends="python3-pytest $depends python3-freezegun python3-pytest-cov python3-coverage"
 short_desc="Decorator for caching properties in classes (Python3)"
-maintainer="Orphaned <orphan@voidlinux.org>"
+maintainer="Pulux <pulux@pf4sh.de>"
 license="BSD-3-Clause"
 homepage="https://github.com/pydanny/cached-property"
 distfiles="${PYPI_SITE}/c/cached-property/cached-property-${version}.tar.gz"
-checksum=9217a59f14a5682da7c4b8829deadbfc194ac22e9908ccf7c8820234e80a1504
+checksum=9fa5755838eecbb2d234c3aa390bd80fbd3ac6b6869109bfc1b499f7bd89a130
 
 post_install() {
 	vlicense LICENSE

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-08-07 18:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-12  4:25 [PR PATCH] python3-cached-property: update to 1.5.2 pfpulux
2022-06-14 15:53 ` [PR REVIEW] " sgn
2022-07-23  5:19 ` [PR PATCH] [Updated] " pfpulux
2022-08-07 18:43 ` [PR REVIEW] " classabbyamp
2022-08-07 18:43 ` [PR PATCH] [Merged]: " classabbyamp

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).