summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2022-01-25 11:00:19 +0100
committerLars-Dominik Braun <lars@6xq.net>2022-01-25 11:06:22 +0100
commit605cb7b4bea032efc77e02b12108af9bc5061a72 (patch)
tree9289d590554c6bc8d0fac694ac8f56f968fbe23a /gnu
parentf3655d32a43c6ccc6cb4e464b0fb82075695a952 (diff)
downloadguix-605cb7b4bea032efc77e02b12108af9bc5061a72.tar.gz
gnu: python-uvloop: Update to 0.16.0.
Version 0.14.0 is not compatible with Python 3.9[1]. Additionally unvendor the
copy of libuv, which was unused, but retained in the source tarball,
fix subprocess spawning and enable tests, so we know when future updates
break it.

[1] https://github.com/MagicStack/uvloop/issues/349

* gnu/packages/python-web.scm (python-uvloop): Update to 0.16.0.
[source]: Add snippet to remove pre-built loop.c and vendored libuv.
[arguments]<#:phases>: Substitute /bin/sh in 'preparations phase, override
'check phase and disable failing tests.
[native-inputs]: Remove python-flake8, because it causes test failures
and add python-pytest-timeout.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/python-web.scm39
1 files changed, 32 insertions, 7 deletions
diff --git a/gnu/packages/python-web.scm b/gnu/packages/python-web.scm
index 6e4e44c6cf..406c6cb51b 100644
--- a/gnu/packages/python-web.scm
+++ b/gnu/packages/python-web.scm
@@ -4602,31 +4602,56 @@ hard or impossible to fix in cssselect.")
 (define-public python-uvloop
   (package
     (name "python-uvloop")
-    (version "0.14.0")
+    (version "0.16.0")
     (source
      (origin
        (method url-fetch)
        (uri (pypi-uri "uvloop" version))
        (sha256
-        (base32 "07j678z9gf41j98w72ysrnb5sa41pl5yxd7ib17lcwfxqz0cjfhj"))))
+        (base32 "0a0jzwrhkszknh14alflrp1db6dyjp7ph730f9yc5lb7gc6c4jzp"))
+       (modules '((guix build utils)))
+        (snippet
+         '(begin (delete-file-recursively "vendor")
+                 (delete-file  "uvloop/loop.c")))))
     (build-system python-build-system)
     (arguments
-     '(#:tests? #f ;FIXME: tests hang and with some errors in the way
-       #:phases
+     `(#:phases
        (modify-phases %standard-phases
          (add-after 'unpack 'preparations
            (lambda _
              ;; Use packaged libuv.
              (substitute* "setup.py" (("self.use_system_libuv = False")
                                       "self.use_system_libuv = True"))
-             #t)))))
+             ;; Replace hardcoded shell command.
+             (substitute* "uvloop/loop.pyx"
+               (("b'/bin/sh'") (string-append "b'" (which "sh") "'")))
+             #t))
+         (replace 'check
+           (lambda* (#:key tests? #:allow-other-keys)
+             (when tests?
+               ;; Remove Python module, which conflicts with the installed version,
+               ;; but lacks the built C module.
+               (delete-file-recursively "uvloop")
+               ;; The tests are prone to get stuck. Use pytest-timeout’s --timeout
+               ;; flag to get a meaningful idea about where.
+               (invoke "pytest" "-vv" "--timeout=300"
+                       "-k" ,(string-append
+                              ;; Timeout, because SIGINT cannot be sent to child.
+                              "not test_signals_sigint_pycode_continue "
+                              "and not test_signals_sigint_pycode_stop "
+                              "and not test_signals_sigint_uvcode "
+                              "and not test_signals_sigint_uvcode_two_loop_runs "
+                              ;; It looks like pytest is preventing
+                              ;; custom stdout/stderr redirection,
+                              ;; even with -s.
+                              "and not test_process_streams_redirect "))))))))
     (native-inputs
      (list python-aiohttp
            python-cython
-           python-flake8
            python-psutil
            python-pyopenssl
-           python-twine))
+           python-pytest
+           python-pytest-timeout))
     (inputs
      (list libuv))
     (home-page "https://github.com/MagicStack/uvloop")