Subject: [bug#60941] [PATCH 1/2] gnu: Add python-pypdf.

From: Vagrant Cascadian <[email-masked]>
Date: Wed, 18 Jan 2023 17:36:54 -0800

From e2082819efee20a72b026eebcfc14af279e424c7 Mon Sep 17 00:00:00 2001
From: Vagrant Cascadian <[email-masked]>
Date: Wed, 18 Jan 2023 16:26:41 -0800
Subject: [PATCH 1/2] gnu: Add python-pypdf.

* gnu/packages/pdf.scm (python-pypdf): New varaible.
---
 gnu/packages/pdf.scm | 39 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/gnu/packages/pdf.scm b/gnu/packages/pdf.scm
index 4b9d0623fe..cb94c29bde 100644
--- a/gnu/packages/pdf.scm
+++ b/gnu/packages/pdf.scm
@@ -1260,6 +1260,45 @@ (define-public pdf2svg
 converter using the Poppler and Cairo libraries.")
     (license license:gpl2+)))
 
+(define-public python-pypdf
+  (package
+    (name "python-pypdf")
+    (version "3.2.1")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "pypdf" version))
+              (sha256
+               (base32
+                "1pdq4nbkknx61pk8w75jvx5j921m2676wfkyizsrap5mj92cssxc"))))
+    (build-system python-build-system)
+    (arguments
+     (list #:tests? #f ;pypi source does not contains tests
+           #:phases #~(modify-phases %standard-phases
+                        (replace 'build
+                          (lambda _
+                            (invoke "flit" "build")))
+                        (replace 'install
+                          (lambda* (#:key inputs outputs #:allow-other-keys)
+                            (add-installed-pythonpath inputs outputs)
+                            (for-each (lambda (wheel)
+                                        (invoke "python"
+                                                "-m"
+                                                "pip"
+                                                "install"
+                                                wheel
+                                                (string-append "--prefix="
+                                                               #$output)))
+                                      (find-files "dist" "\\.whl$")))))))
+    (native-inputs (list python-flit))
+    (propagated-inputs (list python-typing-extensions))
+    (home-page "https://github.com/py-pdf/pypdf")
+    (synopsis
+     "A pure-python PDF library")
+    (description
+     "This package provides a pure-python PDF library capable of splitting, merging,
+cropping, and transforming PDF files")
+    (license license:bsd-3)))
+
 (define-public python-pypdf2
   (package
     (name "python-pypdf2")
-- 
2.39.0