~ruther/guix-local

605cb7b4bea032efc77e02b12108af9bc5061a72 — Lars-Dominik Braun 4 years ago f3655d3
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.
1 files changed, 32 insertions(+), 7 deletions(-)

M gnu/packages/python-web.scm
M gnu/packages/python-web.scm => gnu/packages/python-web.scm +32 -7
@@ 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")