guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#63139] [PATCH python 02/20] gnu: Add python-pyproject-hooks.


From: John Kehayias
Subject: [bug#63139] [PATCH python 02/20] gnu: Add python-pyproject-hooks.
Date: Fri, 28 Apr 2023 05:50:04 +0000

* gnu/packages/python-build.scm (python-pyproject-hooks): New variable.
---
 gnu/packages/python-build.scm | 41 +++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/gnu/packages/python-build.scm b/gnu/packages/python-build.scm
index 70719c44d4..45b9f52b68 100644
--- a/gnu/packages/python-build.scm
+++ b/gnu/packages/python-build.scm
@@ -10,6 +10,7 @@
 ;;; Copyright © 2020, 2021, 2022, 2023 Ricardo Wurmus <rekado@elephly.net>
 ;;; Copyright © 2022 Garek Dyszel <garekdyszel@disroot.org>
 ;;; Copyright © 2022 Greg Hogan <code@greghogan.com>
+;;; Copyright © 2023 John Kehayias <john.kehayias@protonmail.com>

 ;;;
 ;;; This file is part of GNU Guix.
@@ -381,6 +382,46 @@ (define-public python-pep517-bootstrap
       "Wrappers to build Python packages using PEP 517 hooks.")
      (license license:expat))))

+(define-public python-pyproject-hooks
+  (package
+    (name "python-pyproject-hooks")
+    (version "1.0.0")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "pyproject_hooks" version))
+              (sha256
+               (base32
+                "1xaf4sharvacqlav6w3b38nc4j0rzg0p4axi7zamanbzp6cb4wgj"))))
+    (build-system python-build-system)
+    (arguments
+     (list #:tests? #f ; disabled to avoid cycle
+           #:phases
+           #~(modify-phases %standard-phases
+               (add-after 'unpack 'use-toml-instead-of-tomli
+                 ;; Using toml instead of tomli eases bootstrapping.
+                 (lambda _
+                   (substitute* "pyproject.toml"
+                     (("\"tomli.*")
+                      "\"toml\","))))
+               (replace 'build
+                 (lambda _
+                   (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)))))))
+    (native-inputs (list python-flit-core-bootstrap 
python-pypa-build-bootstrap))
+    ;; XXX: python-wheel isn't needed but replicate the pep517 package or else
+    ;; fix packages which will then need python-whell as an input.
+    (propagated-inputs (list python-toml python-wheel))
+    (home-page "https://pyproject-hooks.readthedocs.io";)
+    (synopsis "Wrappers to call pyproject.toml-based build backend hooks")
+    (description "This is a low-level library for calling build-backends in
+@code{pyproject.toml}-based project.  It provides the basic functionality to
+help write tooling that generates distribution files from Python projects.")
+    (license license:expat)))
+
 (define-public python-pyparsing
   (package
     (name "python-pyparsing")
--
2.39.2







reply via email to

[Prev in Thread] Current Thread [Next in Thread]