* gnu/packages/pdf.scm (python-pymupdf): New variable.
---
gnu/packages/pdf.scm | 58 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 58 insertions(+)
Toggle diff (91 lines)
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