~ruther/guix-local

f8ba50a139146b8379cf7a466ca155cdf3e9c5b0 — Sharlatan Hellseher 4 months ago f766f08
gnu: python-nanopb: Switch to pyproject.

* gnu/packages/protobuf.scm (python-nanopb)[build-system]: Switch to
pyproject-build-system.
[arguments] <phases>: 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
1 files changed, 9 insertions(+), 10 deletions(-)

M gnu/packages/protobuf.scm
M gnu/packages/protobuf.scm => gnu/packages/protobuf.scm +9 -10
@@ 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")))