~ruther/guix-local

e4c2f803fa210ef560cacb7e90ac2301f978a37d — Sharlatan Hellseher 8 months ago 92b76e8
gnu: python-flit-scm: Improve package.

Reduce closure size by removing redundant python-setuptools and
python-wheel as it was a workaround import issue which was resolved by
using flit_core.buildapi directly.

* gnu/packages/python-build.scm (python-flit-scm): Fix indentation.
  [arguments] <build-backend>: Let it auto detect.
  <phases>: Add 'fix-backend.
  [native-inputs]: Remove python-setuptools and python-wheel.

Change-Id: Ib3f591365411ba5f8b710a8256a324dfb7d5b565
1 files changed, 26 insertions(+), 14 deletions(-)

M gnu/packages/python-build.scm
M gnu/packages/python-build.scm => gnu/packages/python-build.scm +26 -14
@@ 672,21 672,33 @@ specified by PEP 517, @code{flit_core.buildapi}.")
  (package
    (name "python-flit-scm")
    (version "1.7.0")
    (source (origin
              (method url-fetch)
              (uri (pypi-uri "flit_scm" version))
              (sha256
               (base32
                "1ckbkykfr7f7wzjzgh0gm7h6v3pqzx2l28rw6dsvl6zk4kxxc6wn"))))
    (source
     (origin
       (method url-fetch)
       (uri (pypi-uri "flit_scm" version))
       (sha256
        (base32 "1ckbkykfr7f7wzjzgh0gm7h6v3pqzx2l28rw6dsvl6zk4kxxc6wn"))))
    (build-system pyproject-build-system)
    (arguments (list #:tests? #f        ;to avoid extra dependencies
                     ;; flit-scm wants to use flit-core, which it renames to
                     ;; 'buildapi', but that isn't found even when adding the
                     ;; current directory to PYTHONPATH.  Use setuptools'
                     ;; builder instead.
                     #:build-backend "setuptools.build_meta"))
    (propagated-inputs (list python-flit-core python-setuptools-scm python-tomli))
    (native-inputs (list python-setuptools python-wheel))
    (arguments
     (list
      #:tests? #f        ;no tests in PyPI archive or Git checkout
      #:phases
      #~(modify-phases %standard-phases
          (add-after 'unpack 'fix-backend
            ;; flit_scm imports flit_core's buildapi and tries to make it
            ;; available as "flit_scm:buildapi", see comment in
            ;; <flit_scm/__init__.py>; but it fails during build phase with
            ;; error: ModuleNotFoundError: No module named
            ;; 'flit_scm:buildapi'.
            ;;
            ;; Use flit_core.buildapi directly to build flit_scm.
            (lambda _
              (substitute* "pyproject.toml"
                (("flit_scm:buildapi") "flit_core.buildapi")))))))
    (propagated-inputs
     (list python-flit-core
           python-setuptools-scm
           python-tomli))
    (home-page "https://gitlab.com/WillDaSilva/flit_scm")
    (synopsis "PEP 518 build backend combining flit_core and setuptools_scm")
    (description "This package provides a PEP 518 build backend that uses