summaryrefslogtreecommitdiff
path: root/gnu
diff options
context:
space:
mode:
authorpinoaffe <pinoaffe@gmail.com>2025-08-28 15:26:11 +0200
committerLiliana Marie Prikler <liliana.prikler@gmail.com>2026-01-12 22:42:10 +0100
commit9df4ee0e6bfc9643813f436b90b5dbb509387a49 (patch)
tree66b2b7c17cffbfd88536953066bc1026cdcf203e /gnu
parentdef4874f7208f37c7994719081e16a2e0b78b0e5 (diff)
gnu: Add python-pymupdf.
* gnu/packages/pdf.scm (python-pymupdf): New variable. Change-Id: I72caf140de862733f9191ad18a67a861cb0f31d5 Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/pdf.scm92
1 files changed, 92 insertions, 0 deletions
diff --git a/gnu/packages/pdf.scm b/gnu/packages/pdf.scm
index cae8d181e1e..64e77c270ae 100644
--- a/gnu/packages/pdf.scm
+++ b/gnu/packages/pdf.scm
@@ -1052,6 +1052,98 @@ line tools for batch rendering @command{pdfdraw}, rewriting files
1052Noto Sans, Space Mono and Ubuntu families.") 1052Noto Sans, Space Mono and Ubuntu families.")
1053 (license license:silofl1.1))) 1053 (license license:silofl1.1)))
1054 1054
1055(define-public python-pymupdf
1056 (package
1057 (name "python-pymupdf")
1058 (version "1.26.7")
1059 (source
1060 (origin
1061 (method git-fetch)
1062 (uri (git-reference
1063 (url "https://github.com/pymupdf/PyMuPDF")
1064 (commit version)))
1065 (file-name (git-file-name name version))
1066 (sha256
1067 (base32
1068 "1h11kd4kd63p0jlhhm0ppb9k8p6l4bp0cdx425xhqa5pw569vs7c"))))
1069 (build-system pyproject-build-system)
1070 (arguments
1071 (list
1072 #:test-flags #~(list
1073 ;; barcode functionality is not included in our build
1074 "--ignore=tests/test_barcode.py"
1075 ;; test_codespell tries to run tests based on git
1076 ;; checkout, which is not present
1077 "--ignore=tests/test_codespell.py"
1078 ;; test_font tries to run pip, thus fails
1079 "--ignore=tests/test_font.py"
1080 ;; test_general tries to run pip, thus fails
1081 "--ignore=tests/test_general.py"
1082 ;; test_pixmap tries to run pip, thus fails
1083 "--ignore=tests/test_pixmap.py"
1084 ;; test_pylint tries to run tests based on git checkout,
1085 ;; which is not present
1086 "--ignore=tests/test_pylint.py"
1087 ;; test_2979 in test_tables fails for unknown reasons
1088 "--ignore=tests/test_tables.py"
1089 ;; test_textbox errors at teardown of test_textbox3 for
1090 ;; unknown reasons
1091 "--ignore=tests/test_textbox.py"
1092 ;; tesseract ocr integration appears to not work
1093 "--ignore=tests/test_tesseract.py"
1094 "--ignore=tests/test_textextract.py")
1095 #:phases #~(modify-phases %standard-phases
1096 (add-after 'unpack 'patch-tests
1097 ;; The test suite wants to run pip to automatically install
1098 ;; packages required for the test suite, so we disable that.
1099 (lambda _
1100 (substitute* "tests/conftest.py"
1101 (("command = f'pip install --upgrade \\{packages\\}'") "command = 'echo noop'"))))
1102 (add-before 'build 'configure-libraries
1103 (lambda* (#:key inputs #:allow-other-keys)
1104 (setenv "PYMUPDF_INCLUDES"
1105 (string-join
1106 (list
1107 (search-input-directory inputs "include/freetype2")
1108 (search-input-directory inputs "include/mupdf"))
1109 ":"))
1110 (setenv "PYMUPDF_SETUP_MUPDF_BUILD" "")
1111 (setenv "PYMUPDF_MUPDF_LIB"
1112 (format #f "~a/lib"
1113 #$(this-package-input "mupdf")))
1114 (setenv "PYMUPDF_SETUP_MUPDF_REBUILD" "0")
1115 (setenv "PYMUPDF_SETUP_MUPDF_OVERWRITE_CONFIG" "0,")
1116 (setenv "PYMUPDF_SETUP_IMPLEMENTATIONS" "a")
1117 (setenv "CC" #$(cc-for-target))
1118 (setenv "CXX" #$(cxx-for-target)))))))
1119 (inputs (list freetype
1120 gumbo-parser
1121 harfbuzz
1122 jbig2dec
1123 libjpeg-turbo
1124 openjpeg
1125 psutils
1126 tesseract-ocr))
1127 (propagated-inputs (list mupdf
1128 python-fonttools
1129 python-pillow
1130 python-pymupdf-fonts))
1131 (native-inputs (list python-codespell
1132 python-flake8
1133 python-psutil ;for tests
1134 python-pylint
1135 python-pytest
1136 python-setuptools
1137 swig-next))
1138 (home-page "https://github.com/pymupdf/PyMuPDF")
1139 (synopsis "Python bindings for the PDF toolkit and renderer MuPDF")
1140 (description "PyMuPDF is a set of Python bindings for MuPDF,
1141which is a viewer, renderer, and toolkit for files in @acronym{PDF, Portable
1142Document Format}, @acronym{XPS, XML Paper Specification}, @acronym{OpenXPS,
1143Open XML Paper Specification}, @acronym{CBZ, Comic Book ZI}P, @acronym{EPUB,
1144Electronic Publication} and @acronym{FB2, Fiction Book 2} (e-books) format.")
1145 (license license:agpl3)))
1146
1055(define-public qpdf 1147(define-public qpdf
1056 (package 1148 (package
1057 (name "qpdf") 1149 (name "qpdf")