projects/guix·blob python-team · refs

452 lines · 18.1 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2016, 2019, 2020 Efraim Flashner <[email protected]>
3;;; Copyright © 2016, 2021 Ricardo Wurmus <[email protected]>
4;;; Copyright © 2017 Marius Bakke <[email protected]>
5;;; Copyright © 2017, 2020, 2021 Ludovic Courtès <[email protected]>
6;;; Copyright © 2017–2021 Tobias Geerinckx-Rice <[email protected]>
7;;; Copyright © 2019 Meiyo Peng <[email protected]>
8;;; Copyright © 2020 Paul Garlick <[email protected]>
9;;; Copyright © 2020 Vincent Legoll <[email protected]>
10;;; Copyright © 2021 Greg Hogan <[email protected]>
11;;; Copyright © 2022 Zhu Zihao <[email protected]>
12;;; Copyright © 2022-2023, 2025-2026 Maxim Cournoyer <[email protected]>
13;;; Copyright © 2023 gemmaro <[email protected]>
14;;; Copyright © 2024 chris <[email protected]>
15;;; Copyright © 2025 Artyom V. Poptsov <[email protected]>
16;;;
17;;; This file is part of GNU Guix.
18;;;
19;;; GNU Guix is free software; you can redistribute it and/or modify it
20;;; under the terms of the GNU General Public License as published by
21;;; the Free Software Foundation; either version 3 of the License, or (at
22;;; your option) any later version.
23;;;
24;;; GNU Guix is distributed in the hope that it will be useful, but
25;;; WITHOUT ANY WARRANTY; without even the implied warranty of
26;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27;;; GNU General Public License for more details.
28;;;
29;;; You should have received a copy of the GNU General Public License
30;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
31
32(define-module (gnu packages pretty-print)
33 #:use-module (guix gexp)
34 #:use-module (guix packages)
35 #:use-module (guix licenses)
36 #:use-module (guix git-download)
37 #:use-module (guix download)
38 #:use-module (guix build-system cmake)
39 #:use-module (guix build-system gnu)
40 #:use-module (guix gexp)
41 #:use-module (guix utils)
42 #:use-module (gnu packages)
43 #:use-module (gnu packages bison)
44 #:use-module (gnu packages boost)
45 #:use-module (gnu packages bdw-gc)
46 #:use-module (gnu packages compression)
47 #:use-module (gnu packages file)
48 #:use-module (gnu packages compiler-tools)
49 #:use-module (gnu packages gcc)
50 #:use-module (gnu packages ghostscript)
51 #:use-module (gnu packages gperf)
52 #:use-module (gnu packages groff)
53 #:use-module (gnu packages gv)
54 #:use-module (gnu packages llvm)
55 #:use-module (gnu packages lua)
56 #:use-module (gnu packages perl)
57 #:use-module (gnu packages pkg-config)
58 #:use-module (gnu packages swig)
59 #:use-module (gnu packages qt))
60
61(define-public a2ps
62 (package
63 (name "a2ps")
64 (version "4.15.8")
65 (source (origin
66 (method url-fetch)
67 (uri (string-append "mirror://gnu/a2ps/a2ps-"
68 version ".tar.gz"))
69 (sha256
70 (base32
71 "1yaksc57qx30ij6qx88pnan19ixdh7651crnnbksigzb6rd924wd"))
72 (modules '((guix build utils)))
73 (snippet
74 ;; Remove timestamp from the installed 'README' file.
75 #~(begin
76 (substitute* "etc/README.in"
77 (("@date@")
78 "1st of some month, sometime after 1970"))))))
79 (build-system gnu-build-system)
80 (arguments
81 (list
82 #:phases
83 #~(modify-phases %standard-phases
84 (add-after 'unpack 'skip-failing-tests
85 (lambda _
86 (substitute* (list "tests/Makefile.am" "tests/Makefile.in")
87 (("(encoding|prolog-2)\\.tst") ""))))
88 (add-before 'build 'patch-scripts
89 (lambda _
90 (substitute*
91 '("afm/make_fonts_map.sh"
92 "tests/defs"
93 "tests/backup.tst"
94 "tests/styles.tst")
95 (("/bin/rm") (which "rm")))))
96 (add-before 'check 'patch-test-files
97 ;; Alternatively, we could unpatch the shebangs in tst files.
98 (lambda* (#:key inputs #:allow-other-keys)
99 (substitute* '("tests/ps-ref/includeres.ps"
100 "tests/gps-ref/includeres.ps")
101 (("/usr/local/bin/perl")
102 (search-input-file inputs "/bin/perl")))
103 ;; Some of the reference postscript contain a 'version 3'
104 ;; string that in inconsistent with the source text in the
105 ;; tstfiles directory. Erroneous search-and-replace?
106 (substitute* '("tests/ps-ref/InsertBlock.ps"
107 "tests/gps-ref/InsertBlock.ps"
108 "tests/ps-ref/bookie.ps"
109 "tests/gps-ref/bookie.ps")
110 (("version 3") "version 2"))
111 (substitute* '("tests/ps-ref/psmandup.ps"
112 "tests/gps-ref/psmandup.ps")
113 (("#! */bin/sh")
114 (string-append "#!" (which "sh")))))))))
115 (native-inputs
116 (list gperf groff perl pkg-config))
117 (inputs
118 (list file gv libgc libpaper psutils))
119 (home-page "https://www.gnu.org/software/a2ps/")
120 (synopsis "Any file to PostScript, including pretty-printing")
121 (description
122 "GNU a2ps converts almost anything to a PostScript file, ready for
123printing. It accomplishes this by being able to delegate files to external
124handlers, such as Groff and Gzip. It handles as many steps as is necessary to
125produce a pretty-printed file. It also includes some extra abilities for
126special cases, such as pretty-printing @samp{-help} output.")
127 (license gpl3+)))
128
129(define-public ansifilter
130 (package
131 (name "ansifilter")
132 (version "2.21")
133 (outputs (list "out" "gui"))
134 (source
135 (origin
136 (method git-fetch)
137 (uri (git-reference
138 (url "https://gitlab.com/saalen/ansifilter")
139 (commit version)))
140 (file-name (git-file-name name version))
141 (sha256
142 (base32 "1pvx4l0k8dw642yisf1wahdqcfw36ny6v3v1lcshvxiqxmwrna3d"))))
143 ;; Stick to makefile since CMakeLists.txt is broken upstream
144 (build-system gnu-build-system)
145 (arguments
146 (list
147 #:tests? #f ;no tests
148 #:phases
149 #~(modify-phases %standard-phases
150 (add-before 'configure 'patch-makefile
151 (lambda _
152 ;; Fixes install failure with qtbase@6
153 (substitute* "makefile"
154 (("[ ]*@echo[ ]*\n")
155 "\n"))))
156 (delete 'configure) ;no configure script
157 (add-after 'build 'build-gui
158 (lambda* (#:key parallel-build? #:allow-other-keys)
159 (invoke "make"
160 "-j" (if parallel-build?
161 (number->string (parallel-job-count))
162 "1")
163 "gui")))
164 (replace 'install
165 (lambda _
166 (invoke "make" "install"
167 (string-append "PREFIX="
168 #$output))))
169 (add-after 'install 'install-gui
170 (lambda _
171 (mkdir-p (string-append #$output:gui "/bin"))
172 (invoke "make" "install-gui"
173 (string-append "PREFIX="
174 #$output:gui)))))))
175 (native-inputs (list qtbase))
176 (inputs (list qtbase))
177 (home-page "http://andre-simon.de/doku/ansifilter/en/ansifilter.html")
178 (synopsis "ANSI sequence filter")
179 (description
180 "Ansifilter handles text files containing ANSI terminal escape codes.
181The command sequences may be stripped or be interpreted to generate formatted
182output (HTML, RTF, TeX, LaTeX, BBCode, Pango).")
183 (license gpl3+)))
184
185(define-public trueprint
186 (package
187 (name "trueprint")
188 (version "5.4")
189 (source
190 (origin
191 (method url-fetch)
192 (uri (string-append "mirror://gnu/trueprint/trueprint-"
193 version ".tar.gz"))
194 (sha256
195 (base32
196 "13rkc0fga10xyf56yy9dnq95zndnfadkhxflnp24skszj21y8jqh"))))
197 (build-system gnu-build-system)
198 (arguments
199 ;; Must define DIFF_CMD for tests to pass
200 '(#:configure-flags '("CPPFLAGS=-DDIFF_CMD=\\\"diff\\\"")))
201 (native-inputs (list gcc-13))
202 (home-page "https://www.gnu.org/software/trueprint/")
203 (synopsis "Pretty-print C sources and other plain text to PostScript")
204 (description
205 "GNU Trueprint translates C source code files as PostScript files.
206In addition to the basic source code output, it can also perform diff-marking,
207indentation counting, function and file indices and more.")
208 (license gpl2)))
209
210(define-public enscript
211 (package
212 (name "enscript")
213 (version "1.6.6")
214 (source
215 (origin
216 (method url-fetch)
217 (uri (string-append "mirror://gnu/enscript/enscript-"
218 version ".tar.gz"))
219 (sha256
220 (base32
221 "1fy0ymvzrrvs889zanxcaxjfcxarm2d3k43c9frmbl1ld7dblmkd"))))
222 (build-system gnu-build-system)
223 (home-page "https://www.gnu.org/software/enscript/")
224 (synopsis "Generating PostScript, including pretty-printing")
225 (description
226 "GNU Enscript is a program to convert ASCII text files to PostScript,
227HTML or RTF formats, to be stored in files or sent immediately to a printer.
228It also includes the capability to perform syntax highlighting for several
229different programming languages.")
230 (license gpl3+)))
231
232(define-public fmt-12
233 (package
234 (name "fmt")
235 (version "12.1.0")
236 (source
237 (origin
238 (method git-fetch)
239 (uri (git-reference
240 (url "https://github.com/fmtlib/fmt")
241 (commit version)))
242 (file-name (git-file-name name version))
243 (sha256
244 (base32 "17b1iwmmpd9cb1g3lzn5pjky73i3268kldmdqpjv6s8rzl73aqk6"))))
245 (build-system cmake-build-system)
246 (arguments '(#:configure-flags '("-DBUILD_SHARED_LIBS=ON")))
247 (home-page "https://fmt.dev")
248 (synopsis "Small and fast C++ formatting library")
249 (description "@code{fmt} (formerly @code{cppformat}) is a formatting
250library for C++. It can be used as a safe alternative to @code{printf} or as
251a fast alternative to @code{IOStreams}.")
252 ;; The library is bsd-2, but documentation and tests include other licenses.
253 (license (list bsd-2 bsd-3 psfl))))
254
255(define-public fmt-11
256 (package
257 (inherit fmt-12)
258 (name "fmt")
259 (version "11.2.0")
260 (source
261 (origin
262 (method git-fetch)
263 (uri (git-reference
264 (url "https://github.com/fmtlib/fmt")
265 (commit version)))
266 (file-name (git-file-name name version))
267 (sha256
268 (base32 "0x8j1k1cnmvv5hbhhyfm7bqw2d2rb3jpmz6bc4a195z8pzj582dh"))))))
269
270(define-public fmt-10
271 (package
272 (inherit fmt-11)
273 (version "10.2.1")
274 (source
275 (origin
276 (method url-fetch)
277 (uri (string-append "https://github.com/fmtlib/fmt/releases/download/"
278 version "/fmt-" version ".zip"))
279 (sha256
280 (base32 "1j8nln7rql2nxkhdlgpmx1c1dp6dyxnar1n5r7sjg0rws6i5289i"))))
281 (native-inputs (list unzip))))
282
283(define-public fmt-9
284 (package
285 (inherit fmt-10)
286 (version "9.1.0")
287 (source
288 (origin
289 (method url-fetch)
290 (uri (string-append "https://github.com/fmtlib/fmt/releases/download/"
291 version "/fmt-" version ".zip"))
292 (sha256
293 (base32 "15n9yi6xzzs7g9rm87kg8y5yhl2zrqj3bjr845saa63f6swlrsyc"))))
294 (arguments
295 (list
296 #:configure-flags ''("-DBUILD_SHARED_LIBS=ON")
297 #:phases
298 (cond
299 ((string-prefix? "i686" (%current-system))
300 #~(modify-phases %standard-phases
301 (add-after 'unpack 'patch
302 (lambda _
303 (invoke
304 "patch" "-p1" "-i"
305 #$(local-file
306 (search-patch "fmt-9-overspecified-tests.patch")))))))
307 (else #~%standard-phases))))))
308
309(define-public fmt-8
310 (package
311 (inherit fmt-10)
312 (version "8.1.1")
313 (source
314 (origin
315 (method url-fetch)
316 (uri (string-append "https://github.com/fmtlib/fmt/releases/download/"
317 version "/fmt-" version ".zip"))
318 (sha256
319 (base32 "0p8f82ijqa57sk72hjf0qviv1wwinmns0p87wiv2v8fvisnqnxr3"))))))
320
321;; Note: Updating fmt causes some 1000s of rebuilds, so let's have a pinned
322;; version. When changing also update the pinned version of spdlog.
323(define-public fmt fmt-12)
324
325(define-public source-highlight
326 (package
327 (name "source-highlight")
328 (version "3.1.9")
329 (source
330 (origin
331 (method url-fetch)
332 (uri (string-append "mirror://gnu/src-highlite/source-highlight-"
333 version ".tar.gz"))
334 (patches (search-patches "source-highlight-gcc-compat.patch"))
335 (sha256
336 (base32
337 "148w47k3zswbxvhg83z38ifi85f9dqcpg7icvvw1cm6bg21x4zrs"))))
338 (build-system gnu-build-system)
339 ;; The ctags that comes with emacs does not support the --excmd options,
340 ;; so can't be used
341 (inputs
342 (list boost-1.83))
343 (native-inputs
344 (list bison flex))
345 (arguments
346 (list #:configure-flags
347 #~(list (string-append "--with-boost=" (assoc-ref %build-inputs "boost")))
348 #:parallel-tests? #f ;There appear to be race conditions
349 #:phases
350 #~(modify-phases %standard-phases
351 (add-before 'build 'rename-lesspipe-to-lesspipe.sh.in
352 (lambda _
353 (substitute* "src/src-hilite-lesspipe.sh.in"
354 (("lesspipe") "lesspipe.sh"))))
355 (add-before 'build 'skip-doc-directory
356 (lambda _
357 (substitute* "Makefile"
358 (("^SUBDIRS = (.*) doc(.*)$" _ before after)
359 (string-append "SUBDIRS = " before
360 " " after "\n")))))
361 (add-before 'check 'patch-test-files
362 (lambda _
363 ;; Unpatch shebangs in test input so that source-highlight
364 ;; is still able to infer input language
365 (substitute* '("tests/test.sh"
366 "tests/test2.sh"
367 "tests/test.tcl")
368 (((string-append "#! *" (which "sh"))) "#!/bin/sh"))
369 ;; Initial patching unrecoverably removes whitespace, so
370 ;; remove it also in the comparison output.
371 (substitute* '("tests/test.sh.html"
372 "tests/test2.sh.html"
373 "tests/test.tcl.html")
374 (("#! */bin/sh") "#!/bin/sh")))))))
375 (home-page "https://www.gnu.org/software/src-highlite/")
376 (synopsis "Produce a document with syntax highlighting from a source file")
377 (description
378 "GNU source-highlight reads in a source code file and produces an output
379file in which the keywords are highlighted in different colors to designate
380their syntactic role. It supports over 150 different languages and it can
381output to 8 different formats, including HTML, LaTeX and ODF. It can also
382output to ANSI color escape sequences, so that highlighted source code can be
383seen in a terminal.")
384 (license gpl3+)
385 (properties '((ftp-directory . "/gnu/src-highlite")))))
386
387(define-public highlight
388 (package
389 (name "highlight")
390 (version "v4.21")
391 (source
392 (origin
393 (method git-fetch)
394 (uri (git-reference
395 (url "https://gitlab.com/saalen/highlight")
396 (commit version)))
397 (file-name (git-file-name name version))
398 (sha256
399 (base32 "0r3s41qzr5g0libvj99p6wgclkqg03lzxnry4hi7l7z0dwfb3m61"))))
400 (build-system gnu-build-system)
401 (arguments
402 (list
403 #:disallowed-references (list qtbase-5 qtbase)
404 #:tests? #f ;no tests
405 #:make-flags #~(let ((confdir (string-append #$output
406 "/share/highlight/config/")))
407 (list (string-append "PREFIX=" #$output)
408 (string-append "HL_CONFIG_DIR=" confdir)
409 (string-append "conf_dir=" confdir)))
410 #:phases
411 #~(modify-phases %standard-phases
412 (delete 'configure) ;no configure script
413 (add-after 'unpack 'fix-search-for-lua
414 (lambda _
415 (let ((ver #$(version-major+minor
416 (package-version (this-package-input "lua")))))
417 (substitute* "src/makefile"
418 (("(LUA_PKG_NAME ?:?= ?).*" _ assignment)
419 (string-append assignment "lua-" ver "\n")))
420 (substitute* "extras/swig/makefile"
421 (("lua")
422 (string-append "lua-" ver))))))
423 (add-after 'install 'install-perl-bindings
424 (lambda* (#:key parallel-build? #:allow-other-keys)
425 (let* ((data (string-append #$output "/share/highlight/"))
426 (conf (string-append #$output "/etc/highlight/"))
427 (perldir (string-append #$output
428 "/lib/perl5/site_perl/"
429 #$(package-version
430 (this-package-input "perl"))))
431 (autodir (string-append perldir
432 "/auto/highlight")))
433 (with-directory-excursion "extras/swig"
434 (invoke "make" "perl" "-j"
435 (if parallel-build?
436 (number->string (parallel-job-count))
437 "1")
438 (string-append "hl_data_dir=" data)
439 (string-append "hl_conf_dir=" conf))
440 (invoke "perl" "-I" "." "testmod.pl")
441 (install-file "highlight.pm" perldir)
442 (install-file "highlight.so" autodir))))))))
443 (native-inputs (list pkg-config swig-4.4))
444 (inputs (list lua boost perl))
445 (home-page "https://gitlab.com/saalen/highlight")
446 (synopsis "Convert code to documents with syntax highlighting")
447 (description
448 "Highlight converts source code to HTML, XHTML, RTF, LaTeX,
449TeX, SVG, BBCode and terminal escape sequences with colored syntax
450highlighting. Language definitions and color themes are customizable.")
451 (license gpl3+)
452 (properties '((lint-hidden-cpe-vendors . ("highlight"))))))