GNU bug report logs - #65806
[PATCH 0/4 pdf-crop-margins python package]

Previous Next

Package: guix-patches;

Reported by: Nicolas Graves <ngraves <at> ngraves.fr>

Date: Thu, 7 Sep 2023 15:20:02 UTC

Owned by: Steve George <steve <at> futurile.net>

Severity: normal

Tags: patch

To reply to this bug, email your comments to 65806 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#65806; Package guix-patches. (Thu, 07 Sep 2023 15:20:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Nicolas Graves <ngraves <at> ngraves.fr>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Thu, 07 Sep 2023 15:20:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Nicolas Graves <ngraves <at> ngraves.fr>
To: guix-patches <at> gnu.org
Subject: [PATCH 0/4 pdf-crop-margins python package]
Date: Thu, 07 Sep 2023 17:18:44 +0200
-- 
Best regards,
Nicolas Graves




Information forwarded to lars <at> 6xq.net, jgart <at> dismail.de, guix-patches <at> gnu.org:
bug#65806; Package guix-patches. (Thu, 07 Sep 2023 23:33:01 GMT) Full text and rfc822 format available.

Message #8 received at 65806 <at> debbugs.gnu.org (full text, mbox):

From: Nicolas Graves <ngraves <at> ngraves.fr>
To: 65806 <at> debbugs.gnu.org
Cc: ngraves <at> ngraves.fr
Subject: [PATCH 2/4] gnu: Add python-pysimplegui.
Date: Fri,  8 Sep 2023 01:32:11 +0200
* gnu/packages/python-xyz.scm (python-pysimplegui): New variable.
---
 gnu/packages/python-xyz.scm | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index c0e4b62418..61a8c57f1e 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -5531,6 +5531,25 @@ (define-public python-pysdl2
 common SDL2 functionality.")
     (license license:cc0)))
 
+(define-public python-pysimplegui
+  (package
+    (name "python-pysimplegui")
+    (version "4.60.4")
+    (source (origin
+              (method url-fetch)
+              (uri (pypi-uri "PySimpleGUI" version))
+              (sha256
+               (base32
+                "1fi39fmh2iw88h2jh5ifd2vdrc6fpihc0pb0pqsyl6m5071q537q"))))
+    (build-system pyproject-build-system)
+    (inputs (list `(,python "tk")))
+    (home-page "https://github.com/PySimpleGUI/PySimpleGUI")
+    (synopsis "Python GUI library")
+    (description
+     "This package provides a simple Graphical User Interface library for
+Python.")
+    (license license:lgpl3)))
+
 (define-public python-pystache
   (package
     (name "python-pystache")
-- 
2.41.0





Information forwarded to guix-patches <at> gnu.org:
bug#65806; Package guix-patches. (Thu, 07 Sep 2023 23:33:02 GMT) Full text and rfc822 format available.

Message #11 received at 65806 <at> debbugs.gnu.org (full text, mbox):

From: Nicolas Graves <ngraves <at> ngraves.fr>
To: 65806 <at> debbugs.gnu.org
Cc: ngraves <at> ngraves.fr
Subject: [PATCH 1/4] gnu: Add python-pymupdf.
Date: Fri,  8 Sep 2023 01:32:10 +0200
* gnu/packages/pdf.scm (python-pymupdf): New variable.
---
 gnu/packages/pdf.scm | 58 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)

diff --git a/gnu/packages/pdf.scm b/gnu/packages/pdf.scm
index e270bdf27f..30cc325d48 100644
--- a/gnu/packages/pdf.scm
+++ b/gnu/packages/pdf.scm
@@ -103,6 +103,7 @@ (define-module (gnu packages pdf)
   #:use-module (gnu packages sdl)
   #:use-module (gnu packages sphinx)
   #:use-module (gnu packages sqlite)
+  #:use-module (gnu packages swig)
   #:use-module (gnu packages tex)
   #:use-module (gnu packages time)
   #:use-module (gnu packages tcl)
@@ -906,6 +907,63 @@ (define-public mupdf
                    license:silofl1.1    ;resources/fonts/{han,noto,sil,urw}
                    license:asl2.0)))) ; resources/fonts/droid
 
+(define-public python-pymupdf
+  (package
+    (name "python-pymupdf")
+    (version "1.22.5")
+    (source
+     (origin
+       ;; Not pypi because it download the third_party tarball.
+        (method git-fetch)
+        (uri (git-reference
+              (url "https://github.com/pymupdf/PyMuPDF")
+              (commit version)))
+        (file-name (git-file-name name version))
+        (sha256
+         (base32 "0n2dvszry5h163x8nn2n33mb2rhjgfjsyllhr02n4fz9madv4rx8"))))
+    (build-system pyproject-build-system)
+    (arguments
+     (list
+      #:test-flags #~(list "-k" "not test_color_count")
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-before 'build 'set-build-env
+            (lambda _
+              (let ((include-mupdf
+                     #$(file-append (this-package-input "mupdf") "/include")))
+                (substitute* "setup.py"
+                  (("^include_dirs = .*$")
+                   (string-append
+                    "include_dirs = [ \"" include-mupdf "/mupdf\", \""
+                    #$(file-append
+                       (this-package-input "freetype") "/include/freetype2")
+                    "\"]\n"))
+                  (("^extra_swig_args = .*$")
+                   (string-append
+                    "extra_swig_args = [ \"-I" include-mupdf "\" ]\n"))))
+              (setenv "CC" "gcc")
+              (setenv "USE_SYSTEM_LIBS" "yes")
+              (setenv "PYMUPDF_SETUP_MUPDF_BUILD" "")
+              (setenv "PYMUPDF_SETUP_MUPDF_THIRD" "0"))))))
+    (inputs (list mupdf
+                  freetype
+                  gumbo-parser
+                  harfbuzz
+                  jbig2dec
+                  libjpeg-turbo
+                  openjpeg
+                  tesseract-ocr))
+    (native-inputs (list gcc
+                         pkg-config
+                         swig
+                         python-pytest
+                         python-fonttools))
+    (home-page "https://github.com/pymupdf/PyMuPDF")
+    (synopsis "Python bindings for the PDF toolkit and renderer MuPDF")
+    (description "This package provides a Python library for data extraction,
+analysis, conversion & manipulation of PDF (and other) documents.")
+    (license license:agpl3+)))
+
 (define-public qpdf
   (package
     (name "qpdf")

base-commit: 72745172d155e489936f694d6b9013cb76272370
prerequisite-patch-id: eb618ab7b10483d917c308a38792af98baa517e2
prerequisite-patch-id: 40b6c9f09f27833367a71ec25d77afae4d2a835e
prerequisite-patch-id: c12968d02d99c253f858586a86b16fa32d41f1c1
prerequisite-patch-id: 09d995d48139f8e61183d5634cda13a01cdb50f7
prerequisite-patch-id: 86baa45ec2aad977c8c8135f7613aa391155de6d
prerequisite-patch-id: 3425fbbff6a603d60b4e143ea2141aabf4ddc92c
prerequisite-patch-id: c373c01aab5dcba3503a97d51c62a595147a041c
prerequisite-patch-id: cda857c790b88c681c4e713c5f71e40291970daf
prerequisite-patch-id: 8e234d0f4d93d2aad499eec8842be3d28da98707
prerequisite-patch-id: 5f664cb2fd995a53765c5ffc19a708ac795cc0c4
prerequisite-patch-id: ed447cba9cf9b7e1a1b47aa27acb14f8f2da0a8e
-- 
2.41.0





Information forwarded to guix-patches <at> gnu.org:
bug#65806; Package guix-patches. (Thu, 07 Sep 2023 23:33:02 GMT) Full text and rfc822 format available.

Message #14 received at 65806 <at> debbugs.gnu.org (full text, mbox):

From: Nicolas Graves <ngraves <at> ngraves.fr>
To: 65806 <at> debbugs.gnu.org
Cc: ngraves <at> ngraves.fr
Subject: [PATCH 3/4] gnu: Add pdf-crop-margins.
Date: Fri,  8 Sep 2023 01:32:12 +0200
* gnu/packages/pdf.scm (pdf-crop-margins): New variable.
---
 gnu/packages/pdf.scm | 57 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)

diff --git a/gnu/packages/pdf.scm b/gnu/packages/pdf.scm
index 30cc325d48..2266296621 100644
--- a/gnu/packages/pdf.scm
+++ b/gnu/packages/pdf.scm
@@ -964,6 +964,63 @@ (define-public python-pymupdf
 analysis, conversion & manipulation of PDF (and other) documents.")
     (license license:agpl3+)))
 
+(define-public pdf-crop-margins
+  (let ((commit "6d89093e33e98ab02196cfc5e06e96003771e735")
+        (revision "0"))
+    (package
+      (name "pdf-crop-margins")
+      (version "2.0.3")
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/abarker/pdfCropMargins")
+               ;; Releases are not in git tags.
+               (commit commit)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32 "0144px9kl927z6gx380i2sd75izqzxnnzl3laih2dwpqp82r9j6f"))))
+      (build-system pyproject-build-system)
+      (arguments
+       (list
+        #:phases
+        #~(modify-phases %standard-phases
+            (add-after 'unpack 'lift-requirements
+              (lambda _
+                (substitute* "setup.py"
+                  (("pillow>=9\\.3\\.0")  ; security issues handled by a patch
+                   "pillow>=9.2.0")))))))
+      (native-inputs (list python-setuptools
+                           python-pillow))
+      (propagated-inputs (list ghostscript
+                               python-pymupdf
+                               python-pysimplegui))
+      (home-page "https://github.com/abarker/pdfCropMargins")
+      (synopsis "Automatically crop the margins of PDF files")
+      (description "The pdfCropMargins program is a command-line application to
+automatically crop the margins of PDF files.  Cropping the margins can make it
+easier to read the pages of a PDF document -- whether the document is printed
+or displayed on a screen -- because the display fonts are larger.
+
+Features
+@itemize
+@item Automatically detects the margins and can crop a given percentage of them.
+@item Can crop all the pages to the same size to give a uniform appearance.
+@item Renders and analyzes page images to find the bounding boxes, which allows
+it to deal with noisy scanned PDFs.
+@item A rudimentary 'undo' capability is implemented by default.
+@item Can crop pages uniformly based on the nth smallest crop values, to help
+with noisy documents where a few pages have unwanted markings in their margins.
+@item Can automatically run a document previewer on the output file.
+@item The format of automatically-generated output-file names is modifiable.
+@item Preserves document catalog information such as outlines if possible.
+@item Crops rotated pages according to their appearance in the document viewer.
+@item Can deal with at least simple cases of password-encrypted files.
+@item Can automatically apply a Ghostscript repair operation to attempt to fix
+corrupt PDF files.
+@end itemize")
+      (license license:gpl3+))))
+
 (define-public qpdf
   (package
     (name "qpdf")
-- 
2.41.0





Information forwarded to guix-patches <at> gnu.org:
bug#65806; Package guix-patches. (Thu, 07 Sep 2023 23:33:03 GMT) Full text and rfc822 format available.

Message #17 received at 65806 <at> debbugs.gnu.org (full text, mbox):

From: Nicolas Graves <ngraves <at> ngraves.fr>
To: 65806 <at> debbugs.gnu.org
Cc: ngraves <at> ngraves.fr
Subject: [PATCH 4/4] gnu: Add pdf-crop-margins-cli.
Date: Fri,  8 Sep 2023 01:32:13 +0200
* gnu/packages/pdf.scm (pdf-crop-margins-cli): New variable.
---
 gnu/packages/pdf.scm | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/gnu/packages/pdf.scm b/gnu/packages/pdf.scm
index 2266296621..7b224746db 100644
--- a/gnu/packages/pdf.scm
+++ b/gnu/packages/pdf.scm
@@ -1021,6 +1021,21 @@ (define-public pdf-crop-margins
 @end itemize")
       (license license:gpl3+))))
 
+(define-public pdf-crop-margins-cli
+  (package
+    (inherit pdf-crop-margins)
+    (name "pdf-crop-margins-cli")
+    (arguments
+     (list #:phases
+           #~(modify-phases %standard-phases
+               (add-after 'unpack 'delete-gui-dependencies
+                 (lambda _
+                   (substitute* "setup.py"
+                     (("\"pillow[><=0-9\\.,]*\",")      "")
+                     (("\"PySimpleGUI[><=0-9\\.,]*\",") "")))))))
+    (native-inputs (list python-wheel python-setuptools))
+    (propagated-inputs (list ghostscript python-pymupdf))))
+
 (define-public qpdf
   (package
     (name "qpdf")
-- 
2.41.0





Owner recorded as Steve George <steve <at> futurile.net>. Request was from Steve George <steve <at> futurile.net> to control <at> debbugs.gnu.org. (Thu, 02 May 2024 13:01:02 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 43 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.