diff mbox series

[bug#57540,RFC,v2,13/19] gnu: Add python-pprintpp.* gnu/packages/python-xyz.scm (python-pprintpp): New variable.

Message ID 87bkrrvxsk.fsf@disroot.org
State Accepted
Headers show
Series [bug#57540] Add ocaml-elpi (a dependency of coq-mathcomp-analysis) | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git-branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

Garek Dyszel Sept. 7, 2022, 6:34 p.m. UTC
* gnu/packages/python-xyz.scm (python-pprintpp): New variable.
---
 gnu/packages/python-xyz.scm | 58 +++++++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)
diff mbox series

Patch

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 2c358b8c58..90bf269341 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -30963,3 +30963,61 @@  (define-public python-hatch-fancy-pypi-readme
     (description "Fancy PyPI READMEs with Hatch")
     ;; MIT License
     (license license:expat)))
+
+(define-public python-pprintpp
+  ;; Git version tags are inaccurate for this package, too; use the
+  ;; bare commit.
+  (let ((commit "7ede6da1f3062bbfb32ee04353d675a5bff185e0")
+        (revision "1"))
+    (package
+      (name "python-pprintpp")
+      (version (git-version "0.3.0" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/wolever/pprintpp")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (sha256
+                 (base32
+                  "0nk935m3ig8sc32laqbh698vwpk037yw27gd3nvwwzdv42jal2li"))))
+      (inputs (list python python-pypa-build python-hypothesis python-wheel
+                    python-parameterized))
+      (native-inputs (list python-pytest python-nose))
+      (build-system python-build-system)
+      (arguments
+       ;; Copied directly from the build process for
+       ;; python-jsonschema-next.
+       (substitute-keyword-arguments (package-arguments python-jsonschema)
+         ((#:phases phases)
+          #~(modify-phases #$phases
+              (replace 'build
+                (lambda _
+                  (setenv "SOURCE_DATE_EPOCH" "315532800")
+                  (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))))
+              (replace 'check
+                (lambda* (#:key tests? #:allow-other-keys)
+                  (when tests?
+                    (invoke "python" "test.py"))))))))
+
+      (home-page "https://github.com/wolever/pprintpp")
+      (synopsis "Drop-in replacement for pprint that's actually pretty")
+      (description
+       "This package provides a drop-in replacement for pprint that's actually pretty.")
+      (license license:bsd-3))))