From f8ba50a139146b8379cf7a466ca155cdf3e9c5b0 Mon Sep 17 00:00:00 2001 From: Sharlatan Hellseher Date: Sun, 12 Oct 2025 21:08:17 +0100 Subject: [PATCH] gnu: python-nanopb: Switch to pyproject. * gnu/packages/protobuf.scm (python-nanopb)[build-system]: Switch to pyproject-build-system. [arguments] : Add 'use-poetry-core, and 'pre-build; use default 'build and 'install. [native-inputs]: Remove poetry, and python-pypa-build; add python-poetry-core, and python-setuptools. Change-Id: I67f57a7d4d89c69faca2be689f07a42a61c8d4fb --- gnu/packages/protobuf.scm | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/gnu/packages/protobuf.scm b/gnu/packages/protobuf.scm index 0afdb20df69..51e983cd004 100644 --- a/gnu/packages/protobuf.scm +++ b/gnu/packages/protobuf.scm @@ -491,13 +491,18 @@ from protobuf specification files.") (package (inherit nanopb) (name "python-nanopb") - (build-system python-build-system) + (build-system pyproject-build-system) (arguments (list #:tests? #f ;no Python-specific tests #:phases #~(modify-phases %standard-phases - (replace 'build + (add-after 'unpack 'use-poetry-core + (lambda _ + ;; Patch to use the core poetry API. + (substitute* "extra/poetry/pyproject.toml" + (("poetry.masonry.api") "poetry.core.masonry.api")))) + (add-before 'build 'pre-build (lambda _ (copy-file "extra/poetry/pyproject.toml" "pyproject.toml") (delete-file "build.py") @@ -506,14 +511,8 @@ from protobuf specification files.") (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)) + (invoke "make" "-C" "nanopb/generator/proto")))))) + (native-inputs (list python-poetry-core protobuf python-setuptools)) (propagated-inputs (list python-protobuf)) (synopsis "Small code-size Protocol Buffers implementation in Python")))