summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorEfraim Flashner <efraim@flashner.co.il>2021-10-26 11:06:23 +0300
committerEfraim Flashner <efraim@flashner.co.il>2021-10-26 11:31:51 +0300
commitb7a36599b4533db35e27e0fc5506589fb7c8221f (patch)
tree9edbce9bd17c893bb44b8605a5263fe172b6d1bb /gnu
parentd579df680e38bde3ab94373ae1b293caa28015b9 (diff)
downloadguix-b7a36599b4533db35e27e0fc5506589fb7c8221f.tar.gz
gnu: python-aiohttp: Remove cythonized files.
* gnu/packages/python-web.scm (python-aiohttp)[source]: Add snippet to
remove generated cythonized files.
[arguments]: Add phase to generate cythonized files.
[native-inputs]: Add python-cython.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/python-web.scm23
1 files changed, 21 insertions, 2 deletions
diff --git a/gnu/packages/python-web.scm b/gnu/packages/python-web.scm
index 2b5379950d..a38ed5c268 100644
--- a/gnu/packages/python-web.scm
+++ b/gnu/packages/python-web.scm
@@ -171,7 +171,16 @@ API rules.")
        (method url-fetch)
        (uri (pypi-uri "aiohttp" version))
        (sha256
-        (base32 "1pn79h8fng4xi5gl1f6saw31nxgmgyxl41yf3vba1l21673yr12x"))))
+        (base32 "1pn79h8fng4xi5gl1f6saw31nxgmgyxl41yf3vba1l21673yr12x"))
+       (modules '((guix build utils)))
+       (snippet
+        '(begin
+           (for-each delete-file
+                     '("aiohttp/_frozenlist.c"
+                       "aiohttp/_helpers.c"
+                       "aiohttp/_http_parser.c"
+                       "aiohttp/_http_writer.c"
+                       "aiohttp/_websocket.c"))))))
     (build-system python-build-system)
     (arguments
      '(#:phases
@@ -195,6 +204,15 @@ API rules.")
              ;; Don't test the aiohttp pytest plugin to avoid a dependency loop.
              (delete-file "tests/test_pytest_plugin.py")
              #t))
+         (add-before 'build 'cythonize
+           (lambda _
+             ;; Adapted from the Makefile.
+             (with-directory-excursion "aiohttp"
+               (for-each
+                 (lambda (file)
+                   (invoke "cython" "-3"
+                           file "-I" "aiohttp"))
+                 (find-files "." "_.*\\.pyx$")))))
          (replace 'check
            (lambda* (#:key tests? #:allow-other-keys)
              (setenv "PYTHONPATH"
@@ -216,7 +234,8 @@ API rules.")
        ("python-typing-extensions" ,python-typing-extensions)
        ("python-yarl" ,python-yarl)))
     (native-inputs
-     `(("python-pytest" ,python-pytest)
+     `(("python-cython" ,python-cython)
+       ("python-pytest" ,python-pytest)
        ("python-pytest-mock" ,python-pytest-mock)
        ("python-re-assert" ,python-re-assert)
        ("gunicorn" ,gunicorn-bootstrap)