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