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.
This commit is contained in:
Ricardo Wurmus 2023-04-20 22:41:33 +02:00
parent d0ca8f41c1
commit 54616b0bae
No known key found for this signature in database
GPG key ID: 197A5888235FACAC

View file

@ -31,6 +31,7 @@ (define-module (gnu packages rpc)
#: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 @@ (define-public python-grpcio
(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 @@ (define-public python-grpcio
"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 @@ (define-public python-grpcio
(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")