projects/guix·blob python-team · refs

383 lines · 14.2 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2015 Paul van der Walt <[email protected]>
3;;; Copyright © 2020 Nicolas Goaziou <[email protected]>
4;;; Copyright © 2020 Tobias Geerinckx-Rice <[email protected]>
5;;; Copyright © 2020, 2021, 2025, 2026 Guillaume Le Vaillant <[email protected]>
6;;; Copyright © 2022 Maxim Cournoyer <[email protected]>
7;;;
8;;; This file is part of GNU Guix.
9;;;
10;;; GNU Guix is free software; you can redistribute it and/or modify it
11;;; under the terms of the GNU General Public License as published by
12;;; the Free Software Foundation; either version 3 of the License, or (at
13;;; your option) any later version.
14;;;
15;;; GNU Guix is distributed in the hope that it will be useful, but
16;;; WITHOUT ANY WARRANTY; without even the implied warranty of
17;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18;;; GNU General Public License for more details.
19;;;
20;;; You should have received a copy of the GNU General Public License
21;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
22
23(define-module (gnu packages djvu)
24 #:use-module ((guix licenses) #:prefix license:)
25 #:use-module (guix utils)
26 #:use-module (guix packages)
27 #:use-module (guix download)
28 #:use-module (guix gexp)
29 #:use-module (guix git-download)
30 #:use-module (guix build-system gnu)
31 #:use-module (guix build-system pyproject)
32 #:use-module (gnu packages autotools)
33 #:use-module (gnu packages base)
34 #:use-module (gnu packages bash)
35 #:use-module (gnu packages boost)
36 #:use-module (gnu packages check)
37 #:use-module (gnu packages compression)
38 #:use-module (gnu packages gawk)
39 #:use-module (gnu packages gettext)
40 #:use-module (gnu packages ghostscript)
41 #:use-module (gnu packages glib)
42 #:use-module (gnu packages gnome)
43 #:use-module (gnu packages image)
44 #:use-module (gnu packages imagemagick)
45 #:use-module (gnu packages linux)
46 #:use-module (gnu packages ncurses)
47 #:use-module (gnu packages ocr)
48 #:use-module (gnu packages pdf)
49 #:use-module (gnu packages pkg-config)
50 #:use-module (gnu packages python)
51 #:use-module (gnu packages python-build)
52 #:use-module (gnu packages python-check)
53 #:use-module (gnu packages python-graphics)
54 #:use-module (gnu packages python-web)
55 #:use-module (gnu packages python-xyz)
56 #:use-module (gnu packages qt)
57 #:use-module (gnu packages tex)
58 #:use-module (gnu packages wxwidgets)
59 #:use-module (gnu packages xml)
60 #:use-module (gnu packages xorg))
61
62(define-public djvulibre
63 (package
64 (name "djvulibre")
65 (version "3.5.28")
66 (source
67 (origin
68 (method url-fetch)
69 (uri (string-append "mirror://sourceforge/djvu/DjVuLibre/"
70 (string-replace-substring version "." ",")
71 "/djvulibre-" version ".tar.gz"))
72 (sha256
73 (base32 "0manxn1ly5n8nqamv47hz7akxi6v0rzwc9j1c3x99vngrjlr5qw2"))
74 (modules '((guix build utils)))
75 (snippet
76 '(begin
77 ;; This bundles software (e.g., zlib) and is entirely superfluous.
78 (delete-file-recursively "win32")
79 #t))))
80 (build-system gnu-build-system)
81 (native-inputs
82 ;; The 3.5.28 release tarball isn't bootstrapped.
83 (list autoconf automake libtool))
84 (inputs
85 (list libjpeg-turbo libtiff zlib))
86 (arguments
87 `(#:phases
88 (modify-phases %standard-phases
89 (add-after 'bootstrap 'make-reproducible
90 (lambda _
91 ;; Ensure there are no timestamps in .svgz files.
92 (substitute* "desktopfiles/Makefile.am"
93 (("gzip") "gzip -n"))
94 #t)))))
95 (home-page "https://djvu.sourceforge.net/")
96 (synopsis "Implementation of DjVu, the document format")
97 (description "DjVuLibre is an implementation of DjVu,
98including viewers, browser plugins, decoders, simple encoders, and
99utilities.")
100 (license license:gpl2+)))
101
102(define-public djview
103 (package
104 (name "djview")
105 (version "4.12")
106 (source
107 (origin
108 (method git-fetch)
109 (uri (git-reference
110 (url "https://git.code.sf.net/p/djvu/djview-git")
111 (commit (string-append "release." version))))
112 (sha256
113 (base32 "0mn9ywjbc7iga50lbjclrk892g0x0rap0dmb6ybzjyarybdhhcxp"))
114 (file-name (git-file-name name version))))
115 (build-system gnu-build-system)
116 (native-inputs
117 (list autoconf automake libtool pkg-config qttools-5))
118 (inputs
119 (list djvulibre glib libxt libtiff qtbase-5))
120 (arguments
121 `(#:phases
122 (modify-phases %standard-phases
123 (add-after 'unpack 'fix-desktop-file
124 ;; Executable is "djview", not "djview4".
125 (lambda _
126 (substitute* "desktopfiles/djvulibre-djview4.desktop"
127 (("Exec=djview4 %f") "Exec=djview %f"))
128 #t))
129 (add-after 'unpack 'make-files-writable
130 (lambda _
131 (for-each make-file-writable
132 (find-files "."))
133 #t)))))
134 (home-page "https://djvu.sourceforge.net/djview4.html")
135 (synopsis "Viewer for the DjVu image format")
136 (description "DjView is a standalone viewer for DjVu files.
137
138Its features include navigating documents, zooming and panning page images,
139producing and displaying thumbnails, displaying document outlines, searching
140documents for particular words in the hidden text layer, copying hidden text
141to the clipboard, saving pages and documents as bundled or indirect multi-page
142files, and printing page and documents.
143
144The viewer can simultaneously display several pages using a side-by-side or
145a continuous layout.")
146 (license license:gpl2+)))
147
148(define-public pdf2djvu
149 (let ((commit "1c3f38173ebcb8563a694db15bbf54d25b08b01d")
150 (revision "1"))
151 (package
152 (name "pdf2djvu")
153 (version (git-version "0.9.19" revision commit))
154 (source
155 (origin
156 (method git-fetch)
157 (uri (git-reference
158 (url "https://github.com/FriedrichFroebel/pdf2djvu")
159 (commit commit)))
160 (file-name (git-file-name name version))
161 (sha256
162 (base32 "04pfdqgjxkdnrlg6f0yc1lngw3n4pagwwjvh66gjicwhmixz8bf6"))))
163 (build-system gnu-build-system)
164 (native-inputs
165 (list autoconf
166 automake
167 bash-minimal
168 gettext-minimal
169 libtool
170 pkg-config
171 python-minimal
172 python-pillow
173 (texlive-local-tree (list texlive-luatex85
174 texlive-times))))
175 (inputs
176 (list djvulibre
177 exiv2
178 graphicsmagick
179 poppler
180 poppler-data
181 `(,util-linux "lib"))) ;for libuuid
182 (arguments
183 (list #:configure-flags #~(list "CXXFLAGS=-std=gnu++20")
184 #:test-target "test"
185 #:phases
186 #~(modify-phases %standard-phases
187 (add-after 'unpack 'fix-paths
188 (lambda _
189 (substitute* '("tests/test_dpi_detection.jpeg.in"
190 "tests/test_interpolation.png.in"
191 "tests/test_monochrome.jpeg.in"
192 "tests/test_rotated_page.jpeg.in"
193 "tests/test_subsample.jpeg.in")
194 (("/usr/bin/env python")
195 "/usr/bin/env python3"))))
196 (replace 'bootstrap
197 (lambda* (#:key inputs #:allow-other-keys)
198 (substitute* "private/autogen"
199 (("/usr/share/libtool")
200 (search-input-directory inputs "/share/libtool"))
201 (("/usr/share/gettext")
202 (search-input-directory inputs "/share/gettext")))
203 (invoke "bash" "private/autogen")))
204 (add-before 'check 'set-home-for-tests
205 (lambda _
206 (setenv "HOME" "/tmp"))))))
207 (synopsis "PDF to DjVu converter")
208 (description
209 "@code{pdf2djvu} creates DjVu files from PDF files.
210It is able to extract:
211@itemize
212@item graphics,
213@item text layer,
214@item hyperlinks,
215@item document outline (bookmarks),
216@item metadata (including XMP metadata).
217@end itemize\n")
218 (home-page "https://jwilk.net/software/pdf2djvu")
219 (license license:gpl2))))
220
221(define-public djvu2pdf
222 (package
223 (name "djvu2pdf")
224 (version "0.9.2")
225 (source
226 (origin
227 (method url-fetch)
228 (uri (string-append "https://0x2a.at/site/projects/djvu2pdf/djvu2pdf-"
229 version ".tar.gz"))
230 (sha256
231 (base32 "0v2ax30m7j1yi4m02nzn9rc4sn4vzqh5vywdh96r64j4pwvn5s5g"))))
232 (build-system gnu-build-system)
233 (inputs
234 (list djvulibre
235 gawk
236 ghostscript
237 grep
238 ncurses
239 which))
240 (arguments
241 `(#:tests? #f ; No test suite
242 #:phases
243 (modify-phases %standard-phases
244 (add-after 'unpack 'fix-paths
245 (lambda* (#:key inputs #:allow-other-keys)
246 (let ((djvulibre (assoc-ref inputs "djvulibre"))
247 (gawk (assoc-ref inputs "gawk"))
248 (ghostscript (assoc-ref inputs "ghostscript"))
249 (grep (assoc-ref inputs "grep"))
250 (ncurses (assoc-ref inputs "ncurses"))
251 (which (assoc-ref inputs "which")))
252 (substitute* "djvu2pdf"
253 (("awk")
254 (string-append gawk "/bin/awk"))
255 (("ddjvu")
256 (string-append djvulibre "/bin/ddjvu"))
257 (("djvudump")
258 (string-append djvulibre "/bin/djvudump"))
259 (("grep")
260 (string-append grep "/bin/grep"))
261 (("gs")
262 (string-append ghostscript "/bin/gs"))
263 (("tput ")
264 (string-append ncurses "/bin/tput "))
265 (("which")
266 (string-append which "/bin/which"))))
267 #t))
268 (delete 'configure)
269 (delete 'build)
270 (replace 'install
271 (lambda* (#:key outputs #:allow-other-keys)
272 (let ((out (assoc-ref %outputs "out")))
273 (install-file "djvu2pdf"
274 (string-append out "/bin"))
275 (install-file "djvu2pdf.1.gz"
276 (string-append out "/share/man/man1"))
277 #t))))))
278 (synopsis "DjVu to PDF converter")
279 (description "This is a small tool to convert DjVu files to PDF files.")
280 (home-page "https://0x2a.at/site/projects/djvu2pdf/")
281 (license license:gpl2+)))
282
283(define-public minidjvu
284 (package
285 (name "minidjvu")
286 (version "0.8")
287 (source
288 (origin
289 (method url-fetch)
290 (uri (string-append "mirror://sourceforge/minidjvu/minidjvu/"
291 version "/minidjvu-" version ".tar.gz"))
292 (sha256
293 (base32 "0jmpvy4g68k6xgplj9zsl6brg6vi81mx3nx2x9hfbr1f4zh95j79"))))
294 (build-system gnu-build-system)
295 (native-inputs
296 `(("gettext" ,gettext-minimal)))
297 (inputs
298 (list libjpeg-turbo libtiff zlib))
299 (arguments
300 '(#:configure-flags '("--disable-static")
301 #:parallel-build? #f
302 #:tests? #f ; No test suite
303 #:phases
304 (modify-phases %standard-phases
305 (add-after 'unpack 'fix-paths
306 (lambda _
307 (substitute* "Makefile.in"
308 (("/usr/bin/gzip")
309 "gzip"))
310 #t))
311 (add-before 'install 'make-lib-directory
312 (lambda* (#:key outputs #:allow-other-keys)
313 (mkdir-p (string-append (assoc-ref outputs "out") "/lib"))
314 #t)))))
315 (synopsis "Black and white DjVu encoder")
316 (description
317 "@code{minidjvu} is a multipage DjVu encoder and single page
318encoder/decoder. It doesn't support colors or grayscales, just black
319and white.")
320 (home-page "https://sourceforge.net/projects/minidjvu/")
321 (license license:gpl2)))
322
323(define-public didjvu
324 (package
325 (name "didjvu")
326 (version "0.11.0")
327 (source
328 (origin
329 (method git-fetch)
330 (uri (git-reference
331 ;; It's a fork of https://github.com/jwilk/didjvu, see:
332 ;; <https://github.com/FriedrichFroebel/didjvu/issues/47>.
333 (url "https://github.com/FriedrichFroebel/didjvu")
334 (commit version)))
335 (file-name (git-file-name name version))
336 (sha256
337 (base32 "11z9daa5qfm8cqaxdywfvrnaxid33p7lidj7i8xzv30wyzxdr6zg"))))
338 (build-system pyproject-build-system)
339 (arguments
340 (list
341 #:test-backend #~'unittest
342 #:test-flags
343 #~(list "discover" "--verbose" "--start-directory" "tests/")
344 #:phases
345 #~(modify-phases %standard-phases
346 (add-before 'check 'disable-failing-test
347 (lambda _
348 (substitute* "tests/test_ipc.py"
349 ;; test_path fails to find a file it should have created
350 (("path = os\\.getenv\\('PATH'\\)")
351 "return True"))
352 (substitute* (list "tests/test_ipc.py" "tests/test_cli.py")
353 ;; XXX: See:
354 ;; <https://github.com/FriedrichFroebel/didjvu/issues/48>.
355 (((string-append "(test_action_no_args|test_bad_action|"
356 "test_no_args|test_wait_signal)")
357 all)
358 (string-append "__off_" all)))))
359 (add-after 'wrap 'wrap-path
360 (lambda* (#:key inputs #:allow-other-keys)
361 (wrap-program (string-append #$output "/bin/didjvu")
362 `("PATH" ":" prefix
363 (,(dirname (search-input-file inputs "bin/ddjvu"))))))))))
364 (native-inputs
365 (list boost
366 tzdata-for-tests
367 python-setuptools))
368 (inputs
369 (list bash-minimal
370 djvulibre
371 gexiv2
372 minidjvu
373 python-gamera
374 python-pillow
375 python-py3exiv2
376 python-pygobject
377 python-xmp-toolkit))
378 (synopsis "DjVu encoder with foreground/background separation")
379 (description
380 "@code{didjvu} uses the @code{Gamera} framework to separate the foreground
381and background layers of images, which can then be encoded into a DjVu file.")
382 (home-page "https://jwilk.net/software/didjvu")
383 (license license:gpl2)))