[bug#76835,v3,37/40] gnu: python-ratelimiter: Update to 1.2.0-0.da78a45.

Message ID 20250310021652.17530-37-ngraves@ngraves.fr
State New
Headers
Series [bug#76835,v3,01/40] gnu: gunicorn: Migrate 'check phase to pyproject-build-system. |

Commit Message

Nicolas Graves March 10, 2025, 2:16 a.m. UTC
  * gnu/packages/python-xyz.scm (python-ratelimiter): Update to 1.2.0-0.da78a45.
[native-inputs]: Add python-pytest, python-pytest-asyncio,
python-setuptools, python-wheel.
[arguments]{phases}: Add 'patch phase.
---
 gnu/packages/python-xyz.scm | 62 ++++++++++++++++++++++++++-----------
 1 file changed, 44 insertions(+), 18 deletions(-)
  

Patch

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index a12edc7ab0..81b8386049 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -27885,25 +27885,51 @@  (define-public python-tracerite
     (license license:unlicense)))
 
 (define-public python-ratelimiter
-  (package
-    (name "python-ratelimiter")
-    (version "1.2.0")
-    (source
-     (origin
-       (method url-fetch)
-       (uri (pypi-uri "ratelimiter" version))
-       (sha256
-        (base32
-         "1dhz85mj5bqd2mij84ncs6pz32hgidr79hay4aqfmzaa4rbb497p"))))
-    (build-system python-build-system)
-    (arguments
-     '(#:tests? #f))          ; There are no tests in the pypi archive.
-    (home-page "https://github.com/RazerM/ratelimiter")
-    (synopsis "Simple rate limiting object")
-    (description
-     "The @code{ratelimiter} module ensures that an operation will not be
+  ;; Latest commit of the archived repository.
+  (let ((commit "da78a45867c3a204083c6ea8ee74f6b3e78ef524")
+        (revision "0"))
+    (package
+      (name "python-ratelimiter")
+      (version (git-version "1.2.0" revision commit))
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/RazerM/ratelimiter")
+               (commit commit)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32 "1dhfp170wzbn2pfgha5bacc8cmibs5vq4cdgpbibqbwpxm797xrb"))))
+      (build-system pyproject-build-system)
+      (arguments
+       (list #:phases
+             #~(modify-phases %standard-phases
+                 (add-after 'unpack 'patch
+                   (lambda _
+                     ;; Patch for pytest@7 support
+                     ;; Taken from /pull/13
+                     (substitute* "tests/conftest.py"
+                       (("pytest\\.collect\\.File")
+                        "pytest.File"))
+                     ;; Patch for python@3.8+ support
+                     ;; Taken from /pull/11
+                     (substitute* "ratelimiter/_async.py"
+                       (("with await self\\._alock:")
+                        "async with self._alock:")
+                       (("__aexit__ = asyncio\\.coroutine\\(.*\\)") "\
+async def __aexit__(self, exc_type, exc_value, traceback):
+         return super(AsyncRateLimiter, self).\
+__exit__(exc_type, exc_value, traceback)")))))))
+      (native-inputs (list python-pytest
+                           python-pytest-asyncio
+                           python-setuptools
+                           python-wheel))
+      (home-page "https://github.com/RazerM/ratelimiter")
+      (synopsis "Simple rate limiting object")
+      (description
+       "The @code{ratelimiter} module ensures that an operation will not be
 executed more than a given number of times during a given period.")
-    (license license:asl2.0)))
+      (license license:asl2.0))))
 
 (define-public python-jsonrpclib-pelix
   (package