summary refs log tree commit diff
diff options
context:
space:
mode:
authorRicardo Wurmus <rekado@elephly.net>2023-04-20 22:41:33 +0200
committerRicardo Wurmus <rekado@elephly.net>2023-04-21 13:10:33 +0200
commit54616b0baef3f6a7fb31a329d8557cf111273d1f (patch)
tree6511f21f530e5fb08f50a78242702d13cee9d68e
parentd0ca8f41c14d4e6d8fd7c8d49deaf69c194d3e8f (diff)
downloadguix-54616b0baef3f6a7fb31a329d8557cf111273d1f.tar.gz
gnu: python-grpcio: Rebuild Cythonized source files.
* gnu/packages/rpc.scm (python-grpcio)[source]: Delete generated cpp file.
[build-system]: Use pyproject-build-system.
[arguments]: Patch setup.py to add grpc headers to search path.
[inputs]: Replace abseil-cpp with abseil-cpp-20211102.0; add
grpc-for-python-grpcio.
[native-inputs]: Add python-cython.
-rw-r--r--gnu/packages/rpc.scm14
1 files changed, 12 insertions, 2 deletions
diff --git a/gnu/packages/rpc.scm b/gnu/packages/rpc.scm
index f30876dab4..6ab369bf97 100644
--- a/gnu/packages/rpc.scm
+++ b/gnu/packages/rpc.scm
@@ -31,6 +31,7 @@
   #:use-module (guix utils)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system pyproject)
   #:use-module (guix build-system python)
   #:use-module (gnu packages adns)
   #:use-module (gnu packages autotools)
@@ -207,6 +208,8 @@ type information of gRPC.")
        (modules '((guix build utils) (ice-9 ftw)))
        (snippet
         '(begin
+           ;; Delete this generated file.
+           (delete-file "src/python/grpcio/grpc/_cython/cygrpc.cpp")
            (with-directory-excursion "third_party"
              ;; Delete the bundled source code of libraries that are possible
              ;; to provide as inputs.
@@ -218,18 +221,23 @@ type information of gRPC.")
                                                  "address_sorting"
                                                  "upb"
                                                  "xxhash")))))))))))
-    (build-system python-build-system)
+    (build-system pyproject-build-system)
     (arguments
      (list
       #:phases
       #~(modify-phases %standard-phases
           (add-before 'build 'use-system-libraries
             (lambda _
+              (substitute* "setup.py"
+                (("EXTENSION_INCLUDE_DIRECTORIES = \\(" m)
+                 (string-append m " ('" #$(this-package-input "grpc")
+                                "/include/grpc/impl/codegen/',) + ")))
               (setenv "GRPC_PYTHON_BUILD_SYSTEM_CARES" "1")
               (setenv "GRPC_PYTHON_BUILD_SYSTEM_OPENSSL" "1")
               (setenv "GRPC_PYTHON_BUILD_SYSTEM_ZLIB" "1")
               (setenv "GRPC_PYTHON_BUILD_SYSTEM_RE2" "1")
               (setenv "GRPC_PYTHON_BUILD_SYSTEM_ABSL" "1")
+              (setenv "GRPC_PYTHON_BUILD_WITH_CYTHON" "1")
               ;; Fix the linker options to link with abseil-cpp, which is
               ;; looked under /usr/lib.
               (substitute* "setup.py"
@@ -241,7 +249,9 @@ type information of gRPC.")
               (substitute* '("setup.py" "src/python/grpcio/commands.py")
                 (("'cc'") "'gcc'")))))))
     (inputs
-     (list abseil-cpp c-ares openssl re2 zlib))
+     (list abseil-cpp-20211102.0 c-ares grpc-for-python-grpcio openssl re2 zlib))
+    (native-inputs
+     (list python-cython))
     (propagated-inputs
      (list python-six))
     (home-page "https://grpc.io")