diff mbox series

[bug#41807,25/26] gnu: Add python-uvloop.

Message ID 20200611151357.18843-25-goodoldpaul@autistici.org
State Accepted
Headers show
Series [bug#41807,01/26] gnu: Add python-outcome. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job

Commit Message

Giacomo Leidi June 11, 2020, 3:13 p.m. UTC
* gnu/packages/python-xyz.scm (python-uvloop): New variable.
---
 gnu/packages/python-xyz.scm | 55 +++++++++++++++++++++++++++++++++++++
 1 file changed, 55 insertions(+)
diff mbox series

Patch

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index a8a32cb550..639e6a920f 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -20479,3 +20479,58 @@  etc.).  It's useful for building automated refactoring applications and linters.
     (description "@code{python-pywatchman} is a library to connect and
 query Watchman to discover file changes.")
     (license license:bsd-3)))
+
+(define-public python-uvloop
+  (package
+    (name "python-uvloop")
+    (version "0.14.0")
+    (source
+     (origin
+       (method git-fetch)
+       ;; git-reference because libuv is bundled in the PyPi package
+       (uri (git-reference
+             (url "https://github.com/MagicStack/uvloop.git")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0cvfaddk9195ai29y8nxf92fi71nypx3fhx219q3pammjnh9z861"))
+       (modules '((guix build utils)))
+       (snippet
+        '(begin
+           ;; Unbundle libuv.
+           (substitute* "MANIFEST.in"
+             (("recursive-include vendor/libuv.*") "")
+             (("recursive-exclude vendor/libuv.*") ""))
+           (delete-file-recursively "vendor")
+           #t))))
+    (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (replace 'build
+           (lambda _
+             (invoke "python" "setup.py"
+                     "build_ext" "--inplace"
+                     "--cython-always" "--use-system-libuv")))
+         (replace 'install
+           (lambda* (#:key outputs (configure-flags '()) #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (invoke "python" "setup.py" "install"
+                       (string-append "--prefix=" out)
+                       "--single-version-externally-managed"
+                       "--root=/" "--skip-build"))))
+         ;; Tests depend on libuv being present in-tree.
+         (delete 'check))))
+    (inputs
+     `(("libuv" ,libuv)))
+    (native-inputs
+     `(("python-cython" ,python-cython)))
+    (home-page "https://github.com/MagicStack/uvloop")
+    (synopsis
+     "Fast implementation of asyncio event loop on top of libuv")
+    (description
+     "@code{python-uvloop} is a fast, drop-in replacement of the
+built-in @code{asyncio} event loop.  @code{python-uvloop} is
+implemented in Cython and uses libuv under the hood.")
+    (license license:expat)))