Commit | Line | Data |
---|---|---|
b1b07d72 | 1 | ;;; GNU Guix --- Functional package management for GNU |
3246cc91 | 2 | ;;; Copyright © 2013, 2015 Ludovic Courtès <ludo@gnu.org> |
afb87784 | 3 | ;;; Copyright © 2015, 2020 Efraim Flashner <efraim@flashner.co.il> |
d109b1e8 | 4 | ;;; Copyright © 2016 Theodoros Foradis <theodoros@foradis.org> |
c8d89256 | 5 | ;;; Copyright © 2017, 2018, 2019 Ricardo Wurmus <rekado@elephly.net> |
c0ad84ff | 6 | ;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr> |
2b295f5a | 7 | ;;; Copyright © 2017 Gábor Boskovits <boskovits@gmail.com> |
d56ecf62 | 8 | ;;; Copyright © 2018 Mathieu Lirzin <mthl@gnu.org> |
34aa9144 | 9 | ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com> |
39e75fa6 | 10 | ;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com> |
79f3e261 | 11 | ;;; Copyright © 2020 Pjotr Prins <pjotr.guix@thebird.nl> |
c578d7a2 | 12 | ;;; Copyright © 2021 Bonface Munyoki Kilyungi <me@bonfacemunyoki.com> |
b1b07d72 LC |
13 | ;;; |
14 | ;;; This file is part of GNU Guix. | |
15 | ;;; | |
16 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
17 | ;;; under the terms of the GNU General Public License as published by | |
18 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
19 | ;;; your option) any later version. | |
20 | ;;; | |
21 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
22 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
23 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
24 | ;;; GNU General Public License for more details. | |
25 | ;;; | |
26 | ;;; You should have received a copy of the GNU General Public License | |
27 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
28 | ||
29 | (define-module (gnu packages graphviz) | |
30 | #:use-module (guix packages) | |
31 | #:use-module (guix build-system gnu) | |
abdd28e8 | 32 | #:use-module (guix build-system python) |
b1b07d72 | 33 | #:use-module (guix download) |
c016e390 RW |
34 | #:use-module (guix git-download) |
35 | #:use-module (guix utils) | |
b1aac582 | 36 | #:use-module (gnu packages) |
c8d89256 RW |
37 | #:use-module (gnu packages autotools) |
38 | #:use-module (gnu packages bison) | |
8b1c0dab | 39 | #:use-module (gnu packages check) |
c8d89256 | 40 | #:use-module (gnu packages compression) |
c016e390 | 41 | #:use-module (gnu packages flex) |
c8d89256 RW |
42 | #:use-module (gnu packages fontutils) |
43 | #:use-module (gnu packages gd) | |
b1b07d72 | 44 | #:use-module (gnu packages glib) |
c8d89256 RW |
45 | #:use-module (gnu packages gnome) |
46 | #:use-module (gnu packages gtk) | |
93d2456c | 47 | #:use-module (gnu packages guile) |
e55354b8 | 48 | #:use-module (gnu packages image) |
c016e390 | 49 | #:use-module (gnu packages perl) |
b1b07d72 | 50 | #:use-module (gnu packages pkg-config) |
c8d89256 | 51 | #:use-module (gnu packages python) |
c578d7a2 | 52 | #:use-module (gnu packages python-check) |
44d10b1f | 53 | #:use-module (gnu packages python-xyz) |
c578d7a2 | 54 | #:use-module (gnu packages sphinx) |
93d2456c | 55 | #:use-module (gnu packages swig) |
c016e390 | 56 | #:use-module (gnu packages tcl) |
d56ecf62 | 57 | #:use-module (gnu packages tex) |
c8d89256 RW |
58 | #:use-module (gnu packages xml) |
59 | #:use-module (gnu packages xorg) | |
6414410d | 60 | #:use-module ((guix licenses) #:prefix license:)) |
b1b07d72 LC |
61 | |
62 | (define-public graphviz | |
63 | (package | |
64 | (name "graphviz") | |
8c42cee1 | 65 | (version "2.42.3") |
b1b07d72 | 66 | (source (origin |
2170cc76 AI |
67 | (method url-fetch) |
68 | (uri (string-append | |
8c42cee1 MB |
69 | "https://www2.graphviz.org/Packages/stable/portable_source/" |
70 | "graphviz-" version ".tar.gz")) | |
2170cc76 AI |
71 | (sha256 |
72 | (base32 | |
8c42cee1 | 73 | "1pbswjbx3fjdlsxcm7cmlsl5bvaa3d6gcnr0cr8x3c8pag13zbwg")))) |
b1b07d72 LC |
74 | (build-system gnu-build-system) |
75 | (arguments | |
76 | ;; FIXME: rtest/rtest.sh is a ksh script (!). Add ksh as an input. | |
77 | '(#:tests? #f | |
2170cc76 AI |
78 | #:phases |
79 | (modify-phases %standard-phases | |
2170cc76 AI |
80 | (add-after 'install 'move-docs |
81 | (lambda* (#:key outputs #:allow-other-keys) | |
82 | (let ((out (assoc-ref outputs "out")) | |
83 | (doc (assoc-ref outputs "doc"))) | |
84 | (mkdir-p (string-append doc "/share/graphviz")) | |
85 | (rename-file (string-append out "/share/graphviz/doc") | |
86 | (string-append doc "/share/graphviz/doc")) | |
87 | #t))) | |
88 | (add-after 'move-docs 'move-guile-bindings | |
89 | (lambda* (#:key outputs #:allow-other-keys) | |
90 | (let* ((out (assoc-ref outputs "out")) | |
91 | (lib (string-append out "/lib")) | |
92 | (extdir (string-append lib | |
93 | "/guile/2.0/extensions"))) | |
94 | (mkdir-p extdir) | |
95 | (rename-file (string-append | |
96 | lib "/graphviz/guile/libgv_guile.so") | |
97 | (string-append extdir | |
98 | "/libgv_guile.so")) | |
99 | #t)))))) | |
b1b07d72 LC |
100 | (inputs |
101 | `(("libXrender" ,libxrender) | |
102 | ("libX11" ,libx11) | |
103 | ("gts" ,gts) | |
104 | ("gd" ,gd) ; FIXME: Our GD is too old | |
93d2456c | 105 | ("guile" ,guile-2.0) ;Guile bindings |
b1b07d72 LC |
106 | ("pango" ,pango) |
107 | ("fontconfig" ,fontconfig) | |
108 | ("freetype" ,freetype) | |
3246cc91 | 109 | ("libltdl" ,libltdl) |
b1b07d72 LC |
110 | ("libXaw" ,libxaw) |
111 | ("expat" ,expat) | |
4bd428a7 | 112 | ("libjpeg" ,libjpeg-turbo) |
c4c4cc05 JD |
113 | ("libpng" ,libpng))) |
114 | (native-inputs | |
115 | `(("bison" ,bison) | |
39e75fa6 | 116 | ("swig" ,swig) |
b1b07d72 | 117 | ("pkg-config" ,pkg-config))) |
88377435 | 118 | (outputs '("out" "doc")) ; 5 MiB of html + pdfs |
b1b07d72 LC |
119 | (home-page "http://www.graphviz.org/") |
120 | (synopsis "Graph visualization software") | |
121 | (description | |
30ac136d | 122 | "Graphviz is a graph visualization tool suite. Graph visualization is a |
b1b07d72 LC |
123 | way of representing structural information as diagrams of abstract graphs and |
124 | networks. It has important applications in networking, bioinformatics, | |
125 | software engineering, database and web design, machine learning, and in visual | |
126 | interfaces for other technical domains.") | |
6414410d RW |
127 | (license license:epl1.0))) |
128 | ||
c016e390 RW |
129 | ;; Older Graphviz needed for pygraphviz. See |
130 | ;; https://github.com/pygraphviz/pygraphviz/issues/175 | |
131 | (define-public graphviz-2.38 | |
132 | ;; This commit corresponds to the changelog change for version 2.38.0. | |
133 | ;; There are no tags. | |
134 | (let ((commit "f54ac2c9313ae80ccf76ef4ac6aa9be820a23126") | |
135 | (revision "1")) | |
136 | (package (inherit graphviz) | |
137 | (name "graphviz") | |
138 | (version (git-version "2.38.0" revision commit)) | |
139 | (source (origin | |
140 | (method git-fetch) | |
141 | (uri (git-reference | |
142 | (url "https://gitlab.com/graphviz/graphviz.git") | |
143 | (commit commit))) | |
144 | (file-name (git-file-name name version)) | |
145 | (sha256 | |
146 | (base32 | |
147 | "1vjg308gflmi1khgjmcj431cnkrlv12bg4cqah39mwhny92jy92x")))) | |
148 | (arguments | |
149 | (substitute-keyword-arguments (package-arguments graphviz) | |
150 | ((#:phases phases) | |
151 | `(modify-phases ,phases | |
152 | (add-after 'unpack 'prepare-bootstrap | |
153 | (lambda _ | |
154 | (substitute* "autogen.sh" | |
155 | (("/bin/sh") (which "sh")) | |
156 | (("\\$GRAPHVIZ_VERSION_DATE") "0")) | |
157 | (setenv "CONFIG_SHELL" (which "sh")) | |
158 | (setenv "SHELL" (which "sh")) | |
159 | ||
160 | (map make-file-writable (find-files "." ".*")) | |
161 | #t)) | |
162 | (replace 'bootstrap | |
163 | (lambda _ (invoke (which "sh") "autogen.sh" "NOCONFIG") #t)))))) | |
164 | (native-inputs | |
165 | `(("autoconf" ,autoconf) | |
166 | ("automake" ,automake) | |
167 | ("libtool" ,libtool) | |
168 | ("flex" ,flex) | |
169 | ("perl" ,perl) | |
170 | ("tcl" ,tcl) | |
171 | ,@(package-native-inputs graphviz)))))) | |
172 | ||
6414410d RW |
173 | (define-public python-graphviz |
174 | (package | |
175 | (name "python-graphviz") | |
34aa9144 | 176 | (version "0.13.2") |
6414410d RW |
177 | (source (origin |
178 | (method url-fetch) | |
179 | (uri (pypi-uri "graphviz" version ".zip")) | |
180 | (sha256 | |
181 | (base32 | |
34aa9144 | 182 | "009alrilzx0v7kl41khbq7k6k8b8pxyvbsi1b1ai933f6kpbxb30")))) |
6414410d | 183 | (build-system python-build-system) |
34aa9144 MB |
184 | (arguments |
185 | '(#:phases (modify-phases %standard-phases | |
186 | (replace 'check | |
187 | (lambda* (#:key tests #:allow-other-keys) | |
188 | (if tests | |
189 | (invoke "pytest" "-vv") | |
190 | (format #t "test suite not run~%")) | |
191 | #t))))) | |
6414410d | 192 | (native-inputs |
34aa9144 MB |
193 | `(("unzip" ,unzip) |
194 | ||
195 | ;; For tests. | |
196 | ("graphviz" ,graphviz) | |
197 | ("python-mock" ,python-mock) | |
198 | ("python-pytest" ,python-pytest) | |
199 | ("python-pytest-cov" ,python-pytest-cov) | |
200 | ("python-pytest-mock" ,python-pytest-mock))) | |
6414410d RW |
201 | (home-page "https://github.com/xflr6/graphviz") |
202 | (synopsis "Simple Python interface for Graphviz") | |
203 | (description | |
204 | "This package provides a simple Python interface for the Graphviz graph | |
205 | visualization tool suite.") | |
206 | (license license:expat))) | |
207 | ||
208 | (define-public python2-graphviz | |
209 | (package-with-python2 python-graphviz)) | |
b1b07d72 | 210 | |
8b1c0dab RW |
211 | (define-public python-pygraphviz |
212 | (package | |
213 | (name "python-pygraphviz") | |
214 | (version "1.5") | |
215 | (source | |
216 | (origin | |
217 | (method git-fetch) | |
218 | (uri (git-reference | |
b0e7b699 | 219 | (url "https://github.com/pygraphviz/pygraphviz") |
8b1c0dab RW |
220 | (commit (string-append "pygraphviz-" version)))) |
221 | (file-name (string-append "pygraphviz-" version "-checkout")) | |
222 | (sha256 | |
223 | (base32 | |
224 | "1yldym38m8ckgflln83i88143pd9fjj1vfp23sq39fs6np5g0nzp")))) | |
225 | (build-system python-build-system) | |
226 | (arguments | |
227 | `(#:configure-flags | |
228 | (let ((graphviz (assoc-ref %build-inputs "graphviz"))) | |
229 | (list (string-append "--include-path=" graphviz "/include") | |
230 | (string-append "--library-path=" graphviz "/lib"))))) | |
231 | (inputs | |
232 | `(("graphviz" ,graphviz-2.38))) | |
233 | (native-inputs | |
234 | `(("python-nose" ,python-nose) | |
235 | ("python-mock" ,python-mock) | |
236 | ("python-doctest-ignore-unicode" ,python-doctest-ignore-unicode))) | |
b1ebda07 | 237 | (home-page "https://pygraphviz.github.io") |
8b1c0dab RW |
238 | (synopsis "Python interface to Graphviz") |
239 | (description "PyGraphviz is a Python interface to the Graphviz graph | |
240 | layout and visualization package. With PyGraphviz you can create, edit, read, | |
241 | write, and draw graphs using Python to access the Graphviz graph data | |
242 | structure and layout algorithms.") | |
243 | (license license:bsd-3))) | |
244 | ||
afb87784 EF |
245 | (define-public python2-pygraphviz |
246 | (package-with-python2 python-pygraphviz)) | |
247 | ||
c578d7a2 B |
248 | (define-public python-uqbar |
249 | (package | |
250 | (name "python-uqbar") | |
251 | (version "0.5.1") | |
252 | (source | |
253 | (origin | |
254 | (method git-fetch) | |
255 | (uri (git-reference | |
256 | (url "https://github.com/josiah-wolf-oberholtzer/uqbar") | |
257 | (commit (string-append "v" version)))) | |
258 | (file-name (git-file-name name version)) | |
259 | (sha256 | |
260 | (base32 | |
261 | "0413nyhd8z8v3lvsgaghhafnyxg90fi1q80j1kbl21gpmpnc9a7n")))) | |
262 | (build-system python-build-system) | |
263 | (arguments | |
264 | `(#:phases | |
265 | (modify-phases %standard-phases | |
266 | (add-after 'unpack 'patch | |
267 | (lambda _ | |
268 | (substitute* "setup.py" | |
269 | ;; Latest versions of sphink-rtd-theme require npm to build. | |
270 | (("sphinx-rtd-theme >= 0.4.0") "sphinx-rtd-theme >= 0.2.4") | |
271 | (("black == 19.10b0") "black >= 19.10b0")) | |
272 | #t)) | |
273 | (replace 'check | |
274 | (lambda* (#:key tests? #:allow-other-keys) | |
275 | (when tests? | |
276 | (invoke "python" "-m" "pytest" "tests")) | |
277 | #t))))) | |
278 | (native-inputs | |
279 | `(("graphviz" ,graphviz) | |
280 | ("python-flake8" ,python-flake8) | |
281 | ("python-isort" ,python-isort) | |
282 | ("python-mypy" ,python-mypy) | |
283 | ("python-pytest" ,python-pytest) | |
284 | ("python-pytest-cov" ,python-pytest-cov))) | |
285 | (propagated-inputs | |
286 | `(("python-black" ,python-black) | |
287 | ("python-sphinx" ,python-sphinx) | |
288 | ("python-sphinx-rtd-theme" ,python-sphinx-rtd-theme) | |
289 | ("python-unidecode" ,python-unidecode))) | |
290 | (home-page "https://github.com/josiah-wolf-oberholtzer/uqbar") | |
291 | (synopsis "Tools for building documentation with Sphinx, Graphviz and LaTeX") | |
292 | (description | |
293 | "This package contains tools for building documentation with Sphinx, | |
294 | Graphviz and LaTeX.") | |
295 | (license license:expat))) | |
296 | ||
b1b07d72 LC |
297 | (define-public gts |
298 | (package | |
299 | (name "gts") | |
300 | (version "0.7.6") | |
301 | (source (origin | |
302 | (method url-fetch) | |
de67e922 LF |
303 | (uri (string-append "mirror://sourceforge/gts/gts/" version |
304 | "/gts-" version ".tar.gz")) | |
b1b07d72 LC |
305 | (sha256 |
306 | (base32 | |
307 | "07mqx09jxh8cv9753y2d2jsv7wp8vjmrd7zcfpbrddz3wc9kx705")))) | |
308 | (build-system gnu-build-system) | |
309 | (arguments | |
c0ad84ff TGR |
310 | '(#:phases |
311 | (modify-phases %standard-phases | |
312 | (add-before 'check 'pre-check | |
313 | (lambda _ | |
314 | (chmod "test/boolean/test.sh" #o777) | |
315 | #t))) | |
b1b07d72 LC |
316 | |
317 | ;; Some data files used by the test suite are missing. | |
318 | ;; See <http://sourceforge.net/p/gts/bugs/41/>. | |
319 | #:tests? #f)) | |
c4c4cc05 | 320 | (native-inputs |
b1b07d72 LC |
321 | `(("pkg-config" ,pkg-config))) |
322 | (propagated-inputs | |
323 | ;; The gts.pc file has glib-2.0 as required. | |
324 | `(("glib" ,glib))) | |
325 | (home-page "http://gts.sourceforge.net/") | |
326 | ||
327 | ;; Note: Despite the name, this is not official GNU software. | |
328 | (synopsis "Triangulated Surface Library") | |
329 | (description | |
330 | "Library intended to provide a set of useful functions to deal with | |
331 | 3D surfaces meshed with interconnected triangles.") | |
6414410d | 332 | (license license:lgpl2.0+))) |
abdd28e8 TF |
333 | |
334 | (define-public xdot | |
335 | (package | |
336 | (name "xdot") | |
5395cec2 | 337 | (version "1.1") |
abdd28e8 TF |
338 | (source |
339 | (origin | |
340 | (method url-fetch) | |
341 | (uri (pypi-uri "xdot" version)) | |
342 | (sha256 | |
343 | (base32 | |
5395cec2 | 344 | "0cr4rh7dz4dfzyxrk5pzhm0d15gkrgkfp3i5lw178xy81pc56p71")))) |
abdd28e8 TF |
345 | (build-system python-build-system) |
346 | (arguments | |
347 | `(#:phases | |
348 | (modify-phases %standard-phases | |
349 | ;; We wrap xdot, so that we don't propagate gtk+ and graphviz | |
350 | (add-after 'install 'wrap | |
351 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
352 | (wrap-program (string-append (assoc-ref outputs "out") "/bin/xdot") | |
353 | `("GI_TYPELIB_PATH" ":" prefix | |
354 | (,(string-append | |
355 | (assoc-ref inputs "gtk+") "/lib/girepository-1.0" | |
356 | ":" (assoc-ref inputs "pango") "/lib/girepository-1.0" | |
357 | ":" (assoc-ref inputs "gdk-pixbuf") "/lib/girepository-1.0" | |
358 | ":" (assoc-ref inputs "atk") "/lib/girepository-1.0"))) | |
359 | `("PATH" ":" prefix | |
360 | (,(string-append (assoc-ref inputs "graphviz") "/bin")))) | |
361 | #t))))) | |
362 | (inputs | |
363 | `(("atk" ,atk) | |
364 | ("gdk-pixbuf" ,gdk-pixbuf+svg) | |
365 | ("graphviz" ,graphviz) | |
366 | ("gtk+" ,gtk+) | |
367 | ("python-pycairo" ,python-pycairo) | |
368 | ("python-pygobject" ,python-pygobject))) | |
e85af137 | 369 | (home-page "https://pypi.org/project/xdot/") |
abdd28e8 TF |
370 | (synopsis "Interactive viewer for graphviz dot files") |
371 | (description "Xdot is an interactive viewer for graphs written in | |
372 | @code{graphviz}’s dot language. Internally, it uses the xdot output format as | |
1f595f3c MB |
373 | an intermediate format, and @code{gtk} and @code{cairo} for rendering. Xdot |
374 | can be used either as a standalone application, or as a Python library.") | |
6414410d | 375 | (license license:lgpl3+))) |
2b295f5a GB |
376 | |
377 | (define-public python-pydot | |
378 | (package | |
379 | (name "python-pydot") | |
79f3e261 | 380 | (version "1.4.1") |
2b295f5a GB |
381 | (source |
382 | (origin | |
383 | (method url-fetch) | |
384 | (uri (pypi-uri "pydot" version)) | |
385 | (sha256 | |
386 | (base32 | |
b1aac582 EF |
387 | "00az4cbf8bv447lkk9xi6pjm7gcc7ia33y4pm71fwfwis56rv76l")) |
388 | (patches (search-patches "python-pydot-regression-test.patch")))) | |
2b295f5a | 389 | (build-system python-build-system) |
b1aac582 EF |
390 | (arguments |
391 | '(#:phases | |
392 | (modify-phases %standard-phases | |
393 | (replace 'check | |
394 | ;; Taken from .travis.yaml | |
395 | (lambda* (#:key tests? inputs outputs #:allow-other-keys) | |
396 | (when tests? | |
397 | (add-installed-pythonpath inputs outputs) | |
398 | (with-directory-excursion "test" | |
399 | (invoke "python" "pydot_unittest.py"))) | |
400 | #t))))) | |
29ddbc56 TGR |
401 | (native-inputs |
402 | ;; For tests. | |
b1aac582 EF |
403 | `(("graphviz" ,graphviz) |
404 | ("python-chardet" ,python-chardet))) | |
2b295f5a GB |
405 | (propagated-inputs |
406 | `(("python-pyparsing" ,python-pyparsing))) | |
f8be1474 | 407 | (home-page "https://github.com/pydot/pydot") |
2b295f5a GB |
408 | (synopsis "Python interface to Graphviz's DOT language") |
409 | (description | |
410 | "Pydot provides an interface to create, handle, modify and process | |
411 | graphs in Graphviz's DOT language, written in pure Python.") | |
412 | (license license:expat))) | |
413 | ||
414 | (define-public python2-pydot | |
415 | (package-with-python2 python-pydot)) | |
d56ecf62 ML |
416 | |
417 | (define-public dot2tex | |
418 | (package | |
419 | (name "dot2tex") | |
1cb055f0 | 420 | (version "2.11.3") |
d56ecf62 ML |
421 | (source (origin |
422 | (method url-fetch) | |
423 | (uri (pypi-uri "dot2tex" version)) | |
424 | (sha256 | |
425 | (base32 | |
1cb055f0 | 426 | "1kp77wiv7b5qib82i3y3sn9r49rym43aaqm5aw1bwnzfbbq2m6i9")))) |
d56ecf62 ML |
427 | (build-system python-build-system) |
428 | (arguments | |
429 | `(#:python ,python-2)) | |
430 | (inputs | |
431 | `(("texlive-latex-preview" ,texlive-latex-preview) | |
432 | ("graphviz" ,graphviz))) | |
433 | (propagated-inputs | |
434 | `(("python-pyparsing" ,python2-pyparsing))) | |
435 | (home-page "https://github.com/kjellmf/dot2tex") | |
436 | (synopsis "Graphviz to LaTeX converter") | |
437 | (description | |
438 | "The purpose of @code{dot2tex} is to give graphs generated by Graphviz a | |
439 | more LaTeX friendly look and feel. This is accomplished by converting | |
440 | @code{xdot} output from Graphviz to a series of PSTricks or PGF/TikZ commands. | |
441 | This approach allows: | |
442 | ||
443 | @itemize @bullet | |
444 | @item Typesetting labels with LaTeX, allowing mathematical notation | |
445 | @item Using native PSTricks and PGF/TikZ commands for drawing arrows | |
446 | @item Using backend specific styles to customize the output | |
447 | @end itemize") | |
448 | (license license:expat))) |