diff options
author | Marius Bakke <marius@gnu.org> | 2022-09-01 23:26:57 +0200 |
---|---|---|
committer | Marius Bakke <marius@gnu.org> | 2022-09-01 23:26:57 +0200 |
commit | 58863b93b0d9a191d5cca695fe0a0dfbb067ebba (patch) | |
tree | 1ee1aba5905862aaee952689e59dd2d8a9e2fce6 /gnu/packages/protobuf.scm | |
parent | 2e559a358582fd8f56a035d0fac97be229752dfb (diff) | |
parent | 0c518f974e64f23846ae51ea2c68b479202fdca9 (diff) | |
download | guix-58863b93b0d9a191d5cca695fe0a0dfbb067ebba.tar guix-58863b93b0d9a191d5cca695fe0a0dfbb067ebba.tar.gz |
Merge branch 'staging' into core-updates
Diffstat (limited to 'gnu/packages/protobuf.scm')
-rw-r--r-- | gnu/packages/protobuf.scm | 130 |
1 files changed, 130 insertions, 0 deletions
diff --git a/gnu/packages/protobuf.scm b/gnu/packages/protobuf.scm index 6c3a47986d..a61d9d7492 100644 --- a/gnu/packages/protobuf.scm +++ b/gnu/packages/protobuf.scm @@ -36,6 +36,7 @@ #:use-module (guix build-system ruby) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix utils) + #:use-module (gnu packages build-tools) #:use-module (gnu packages compression) #:use-module (gnu packages check) #:use-module (gnu packages gcc) @@ -45,6 +46,7 @@ #:use-module (gnu packages python-build) #:use-module (gnu packages python-check) #:use-module (gnu packages python-xyz) + #:use-module (gnu packages rpc) #:use-module (gnu packages ruby)) (define-public fstrm @@ -237,6 +239,134 @@ encoder in C++. The developer using protozero has to manually translate the license:asl2.0 ; for folly license:bsd-2)))) +(define-public nanopb + (package + (name "nanopb") + (version "0.4.6.4") + (source (origin + (method git-fetch) ;for tests + (uri (git-reference + (url "https://github.com/nanopb/nanopb") + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "0gb6q4igrjj8jap4p1ijza4y8dkjlingzym3cli1w18f90d7xlh7")))) + (build-system cmake-build-system) + (arguments + (list + #:configure-flags #~(list "-DBUILD_SHARED_LIBS=ON" + "-DBUILD_STATIC_LIBS=OFF") + #:phases + #~(modify-phases %standard-phases + (replace 'check + (lambda* (#:key tests? #:allow-other-keys) + (when tests? + (with-directory-excursion "../source/tests" + (invoke "scons")))))))) + (native-inputs (list protobuf python-protobuf python-wrapper scons)) + (home-page "https://jpa.kapsi.fi/nanopb/") + (synopsis "Small code-size Protocol Buffers implementation in ANSI C") + (description "Nanopb is a small code-size Protocol Buffers implementation +in ansi C. It is especially suitable for use in microcontrollers, but fits +any memory-restricted system.") + (license license:zlib))) + +(define-public python-mypy-protobuf + (package + (name "python-mypy-protobuf") + (version "3.3.0") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/nipunn1313/mypy-protobuf") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "0z03h9k68qvnlyhpk0ndwp01bdx77vrjr6mybxq4ldilkkbksklk")))) + (build-system python-build-system) + (arguments + (list + #:phases + #~(modify-phases %standard-phases + ;; XXX: PEP 517 manual build copied from python-isort. + (replace 'build + (lambda _ + ;; ZIP does not support timestamps before 1980. + (setenv "SOURCE_DATE_EPOCH" "315532800") + (invoke "python" "-m" "build" "--wheel" "--no-isolation" "."))) + (replace 'install + (lambda _ + (let ((whl (car (find-files "dist" "\\.whl$")))) + (invoke "pip" "--no-cache-dir" "--no-input" + "install" "--no-deps" "--prefix" #$output whl)))) + (add-before 'check 'generate-protos-for-tests + (lambda _ + ;; Generate Python sources. + (for-each (lambda (proto) + (invoke "protoc" + "--proto_path=proto" + "--experimental_allow_proto3_optional" + "--python_out=test/generated" proto)) + (find-files "." "\\.proto$")) + ;; Generate GRPC protos. + (for-each (lambda (proto) + (invoke "python" "-m" "grpc_tools.protoc" + "--proto_path=proto" + "--experimental_allow_proto3_optional" + "--grpc_python_out=test/generated" proto)) + (find-files "proto/testproto/grpc" "\\.proto$")))) + (replace 'check + (lambda* (#:key tests? #:allow-other-keys) + (setenv "PYTHONPATH" "test/generated") + (invoke "pytest" "-vv" "--ignore=test/generated" "test")))))) + (native-inputs + (list python-grpc-stubs + python-grpcio-tools + python-pypa-build + python-pytest + python-typing-extensions-next)) + (propagated-inputs + (list protobuf + python-protobuf + python-types-protobuf)) + (home-page "https://github.com/nipunn1313/mypy-protobuf") + (synopsis "Generate Mypy stub files from protobuf specifications") + (description "This Python package provide tools to generate Mypy stubs +from protobuf specification files.") + (license license:asl2.0))) + +(define-public python-nanopb + (package + (inherit nanopb) + (name "python-nanopb") + (build-system python-build-system) + (arguments + (list + #:tests? #f ;no Python-specific tests + #:phases + #~(modify-phases %standard-phases + (replace 'build + (lambda _ + (copy-file "extra/poetry/pyproject.toml" "pyproject.toml") + (delete-file "build.py") + ;; Mimick extra/poetry/poetry_build.sh. + (mkdir "nanopb") + (copy-recursively "generator" "nanopb/generator") + (invoke "touch" "nanopb/__init__.py" + "nanopb/generator/__init__.py") + (invoke "make" "-C" "nanopb/generator/proto") + (invoke "python" "-m" "build" "--wheel" "--no-isolation" "."))) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let ((whl (car (find-files "dist" "\\.whl$")))) + (invoke "pip" "--no-cache-dir" "--no-input" + "install" "--no-deps" "--prefix" #$output whl))))))) + (native-inputs (list poetry protobuf python-pypa-build)) + (propagated-inputs (list python-protobuf)) + (synopsis "Small code-size Protocol Buffers implementation in Python"))) + (define-public python-protobuf (package (name "python-protobuf") |