Patchwork [1/3] gnu: Add python-pypdf2.

login
register
mail settings
Submitter Hartmut Goebel
Date Nov. 8, 2016, 9:37 p.m.
Message ID <1478641022-30723-1-git-send-email-h.goebel@crazy-compilers.com>
Download mbox | patch
Permalink /patch/17320/
State New
Headers show

Comments

Hartmut Goebel - Nov. 8, 2016, 9:37 p.m.
* gnu/packages/pdf.scm(python-pypdf2, python2-pypdf2): New variables.
---
 gnu/packages/pdf.scm | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
Leo Famulari - Nov. 8, 2016, 11:55 p.m.
On Tue, Nov 08, 2016 at 10:37:00PM +0100, Hartmut Goebel wrote:
> * gnu/packages/pdf.scm(python-pypdf2, python2-pypdf2): New variables.

> +    (arguments
> +      '(#:tests? #f))  ; no tests

Are these files not relevant?

https://github.com/mstamy2/PyPDF2/tree/master/Tests

> +    (home-page "http://mstamy2.github.com/PyPDF2")
> +    (synopsis "Pure-Python PDF toolkit")

I would replace the hyphen in "Pure-Python" with a space.

> +    (description "A Pure-Python library built as a PDF toolkit.  It is capable

Same here.

> +of:
> +
> +@itemize
> +@item extracting document information (title, author, …)
> +@item splitting documents page by page
> +@item merging documents page by page
> +@item cropping pages
> +@item merging multiple pages into a single page
> +@item encrypting and decrypting PDF files
> +@item and more!
> +@end itemize

We have to use enumerate instead of itemize due to a limitation in
Guile's texinfo -> HTML converter. This is fixed in Guile, but not in
the version that we use currently, IIUC:

https://debbugs.gnu.org/cgi/bugreport.cgi?bug=21772
https://lists.gnu.org/archive/html/guile-commits/2016-06/msg00341.html

$ git describe --contains bd65845497110b179456d4bfdf26854791f0a822
v2.1.4~95
Hartmut Goebel - Nov. 9, 2016, 9:59 p.m.
Am 09.11.2016 um 00:55 schrieb Leo Famulari:
>> +      '(#:tests? #f))  ; no tests
> Are these files not relevant?
> https://github.com/mstamy2/PyPDF2/tree/master/Tests

Ubs, I missed them. This is negligible and fails in Python 3.
nevertheless I added them.

> I would replace the hyphen in "Pure-Python" with a space.
> We have to use enumerate instead of itemize due to a limitation in

Done. I'll send updates patches since again it's late at night :-)

Patch

diff --git a/gnu/packages/pdf.scm b/gnu/packages/pdf.scm
index ee33e3c..558ea89 100644
--- a/gnu/packages/pdf.scm
+++ b/gnu/packages/pdf.scm
@@ -784,3 +784,40 @@  the framebuffer.")
     (description "@command{pdf2svg} is a simple command-line PDF to SVG
 converter using the Poppler and Cairo libraries.")
     (license license:gpl2+)))
+
+(define-public python-pypdf2
+  (package
+    (name "python-pypdf2")
+    (version "1.26.0")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "PyPDF2" version))
+              (sha256
+               (base32
+                "11a3aqljg4sawjijkvzhs3irpw0y67zivqpbjpm065ha5wpr13z2"))))
+    (build-system python-build-system)
+    (arguments
+      '(#:tests? #f))  ; no tests
+    (home-page "http://mstamy2.github.com/PyPDF2")
+    (synopsis "Pure-Python PDF toolkit")
+    (description "A Pure-Python library built as a PDF toolkit.  It is capable
+of:
+
+@itemize
+@item extracting document information (title, author, …)
+@item splitting documents page by page
+@item merging documents page by page
+@item cropping pages
+@item merging multiple pages into a single page
+@item encrypting and decrypting PDF files
+@item and more!
+@end itemize
+
+By being Pure-Python, it should run on any Python platform without any
+dependencies on external libraries.  It can also work entirely on StringIO
+objects rather than file streams, allowing for PDF manipulation in memory.  It
+is therefore a useful tool for websites that manage or manipulate PDFs.")
+    (license license:bsd-3)))
+
+(define-public python2-pypdf2
+  (package-with-python2 python-pypdf2))