gnu: Python: use /nix/.../sh instead of /bin/sh in the subprocess module
[jackhill/guix/guix.git] / gnu / packages / pretty-print.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2014 Eric Bavier <bavier@member.fsf.org>
3 ;;;
4 ;;; This file is part of GNU Guix.
5 ;;;
6 ;;; GNU Guix is free software; you can redistribute it and/or modify it
7 ;;; under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation; either version 3 of the License, or (at
9 ;;; your option) any later version.
10 ;;;
11 ;;; GNU Guix is distributed in the hope that it will be useful, but
12 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;; GNU General Public License for more details.
15 ;;;
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18
19 (define-module (gnu packages pretty-print)
20 #:use-module (guix packages)
21 #:use-module (guix licenses)
22 #:use-module (guix download)
23 #:use-module (guix build-system gnu)
24 #:use-module (gnu packages)
25 #:use-module (gnu packages ghostscript)
26 #:use-module (gnu packages groff)
27 #:use-module (gnu packages imagemagick)
28 #:use-module (gnu packages gv)
29 #:use-module (gnu packages boost)
30 #:use-module (gnu packages bison)
31 #:use-module (gnu packages flex)
32 #:use-module (gnu packages gperf)
33 #:use-module (gnu packages perl)
34 #:use-module (gnu packages file))
35
36 (define-public a2ps
37 (package
38 (name "a2ps")
39 (version "4.14")
40 (source
41 (origin
42 (method url-fetch)
43 (uri (string-append "mirror://gnu/a2ps/a2ps-"
44 version ".tar.gz"))
45 (sha256
46 (base32
47 "195k78m1h03m961qn7jr120z815iyb93gwi159p1p9348lyqvbpk"))))
48 (build-system gnu-build-system)
49 (inputs
50 `(("psutils" ,psutils)
51 ("groff" ,groff)
52 ("gv" ,gv)
53 ("imagemagick" ,imagemagick)))
54 (native-inputs
55 `(("gperf" ,gperf)
56 ("perl" ,perl)
57 ("file" ,file)))
58 (arguments
59 '(#:phases (alist-replace
60 'configure
61 (lambda* (#:key #:allow-other-keys #:rest args)
62 (let ((configure (assoc-ref %standard-phases 'configure)))
63 (substitute* "configure"
64 (("/usr/bin/file") (which "file")))
65 (apply configure args)))
66 (alist-cons-before
67 'build 'patch-scripts
68 (lambda _
69 (substitute*
70 '("afm/make_fonts_map.sh"
71 "tests/defs"
72 "tests/backup.tst"
73 "tests/styles.tst")
74 (("/bin/rm") (which "rm"))))
75 (alist-cons-before
76 'check 'patch-test-files
77 ;; Alternatively, we could unpatch the shebangs in tstfiles
78 (lambda* (#:key inputs #:allow-other-keys)
79 (let ((perl (assoc-ref inputs "perl")))
80 (substitute* '("tests/ps-ref/includeres.ps"
81 "tests/gps-ref/includeres.ps")
82 (("/usr/local/bin/perl")
83 (string-append perl "/bin/perl"))))
84 ;; Some of the reference postscript contain a 'version 3'
85 ;; string that in inconsistent with the source text in the
86 ;; tstfiles directory. Erroneous search-and-replace?
87 (substitute* '("tests/ps-ref/InsertBlock.ps"
88 "tests/gps-ref/InsertBlock.ps"
89 "tests/ps-ref/bookie.ps"
90 "tests/gps-ref/bookie.ps")
91 (("version 3") "version 2"))
92 (substitute* '("tests/ps-ref/psmandup.ps"
93 "tests/gps-ref/psmandup.ps")
94 (("#! */bin/sh") (string-append
95 "#!" (which "sh")))))
96 %standard-phases)))))
97 (home-page "http://www.gnu.org/software/a2ps")
98 (synopsis "Any file to PostScript, including pretty-printing")
99 (description
100 "GNU a2ps converts almost anything to a PostScript file, ready for
101 printing. It accomplishes this by being able to delegate files to external
102 handlers, such as Groff and Gzip. It handles as many steps as is necessary to
103 produce a pretty-printed file. It also includes some extra abilities for
104 special cases, such as pretty-printing \"--help\" output.")
105 (license gpl3+)))
106
107 (define-public trueprint
108 (package
109 (name "trueprint")
110 (version "5.4")
111 (source
112 (origin
113 (method url-fetch)
114 (uri (string-append "mirror://gnu/trueprint/trueprint-"
115 version ".tar.gz"))
116 (sha256
117 (base32
118 "13rkc0fga10xyf56yy9dnq95zndnfadkhxflnp24skszj21y8jqh"))))
119 (build-system gnu-build-system)
120 (native-inputs `(("file" ,file)))
121 (arguments
122 ;; Must define DIFF_CMD for tests to pass
123 '(#:configure-flags '("CPPFLAGS=-DDIFF_CMD=\\\"diff\\\"")
124 #:phases (alist-replace
125 'configure
126 (lambda* (#:key #:allow-other-keys #:rest args)
127 (let ((configure (assoc-ref %standard-phases 'configure)))
128 (substitute* "configure"
129 (("/usr/bin/file") (which "file")))
130 (apply configure args)))
131 %standard-phases)))
132 (home-page "http://www.gnu.org/software/trueprint")
133 (synopsis "Pretty-print C sources and other plain text to PostScript")
134 (description
135 "GNU Trueprint translates C source code files as PostScript files.
136 In addition to the basic source code output, it can also perform diff-marking,
137 indentation counting, function and file indices and more.")
138 (license gpl2)))
139
140 (define-public enscript
141 (package
142 (name "enscript")
143 (version "1.6.6")
144 (source
145 (origin
146 (method url-fetch)
147 (uri (string-append "mirror://gnu/enscript/enscript-"
148 version ".tar.gz"))
149 (sha256
150 (base32
151 "1fy0ymvzrrvs889zanxcaxjfcxarm2d3k43c9frmbl1ld7dblmkd"))))
152 (build-system gnu-build-system)
153 (home-page "http://www.gnu.org/software/enscript")
154 (synopsis "Generating PostScript, including pretty-printing")
155 (description
156 "GNU Enscript is a program to convert ASCII text files to PostScript,
157 HTML or RTF formats, to be stored in files or sent immediately to a printer.
158 It also includes the capability to perform syntax highlighting for several
159 different programming languages.")
160 (license gpl3+)))
161
162 (define-public source-highlight
163 (package
164 (name "source-highlight")
165 (version "3.1.7")
166 (source
167 (origin
168 (method url-fetch)
169 (uri (string-append "mirror://gnu/src-highlite/source-highlight-"
170 version ".tar.gz"))
171 (sha256
172 (base32
173 "1s49ld8cnpzhhwq0r7s0sfm3cg3nhhm0wla27lwraifrrl3y1cp1"))
174 (patches
175 (list (search-patch
176 ;; Patch submitted as Savannah item #41786
177 "source-highlight-regexrange-test.patch")))))
178 (build-system gnu-build-system)
179 ;; The ctags that comes with emacs does not support the --excmd options,
180 ;; so can't be used
181 (inputs
182 `(("boost" ,boost)))
183 (native-inputs
184 `(("bison" ,bison)
185 ("flex" ,flex)
186 ("file" ,file)))
187 (arguments
188 `(#:configure-flags
189 (list (string-append "--with-boost="
190 (assoc-ref %build-inputs "boost")))
191 #:parallel-tests? #f ;There appear to be race conditions
192 #:phases (alist-replace
193 'configure
194 (lambda* (#:key #:allow-other-keys #:rest args)
195 (let ((configure (assoc-ref %standard-phases 'configure)))
196 (substitute* "configure"
197 (("/usr/bin/file") (which "file")))
198 (apply configure args)))
199 (alist-cons-before
200 'check 'patch-test-files
201 (lambda* (#:key inputs #:allow-other-keys)
202 ;; Unpatch shebangs in test input so that source-highlight
203 ;; is still able to infer input language
204 (substitute* '("tests/test.sh"
205 "tests/test2.sh"
206 "tests/test.tcl")
207 (((string-append "#! *" (which "sh"))) "#!/bin/sh"))
208 ;; Initial patching unrecoverably removes whitespace, so
209 ;; remove it also in the comparison output.
210 (substitute* '("tests/test.sh.html"
211 "tests/test2.sh.html"
212 "tests/test.tcl.html")
213 (("#! */bin/sh") "#!/bin/sh")))
214 %standard-phases))))
215 (home-page "http://www.gnu.org/software/src-highlite")
216 (synopsis "Produce a document with syntax highlighting from a source file")
217 (description
218 "GNU source-highlight reads in a source code file and produces an output
219 file in which the keywords are highlighted in different colors to designate
220 their syntactic role. It supports over 150 different languages and it can
221 output to 8 different formats, including HTML, LaTeX and ODF. It can also
222 output to ANSI color escape sequences, so that highlighted source code can be
223 seen in a terminal.")
224 (license gpl3+)))