1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2015 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2015, 2020 Efraim Flashner <efraim@flashner.co.il>
4 ;;; Copyright © 2016 Theodoros Foradis <theodoros@foradis.org>
5 ;;; Copyright © 2017, 2018, 2019 Ricardo Wurmus <rekado@elephly.net>
6 ;;; Copyright © 2017, 2018 Tobias Geerinckx-Rice <me@tobias.gr>
7 ;;; Copyright © 2017 Gábor Boskovits <boskovits@gmail.com>
8 ;;; Copyright © 2018 Mathieu Lirzin <mthl@gnu.org>
9 ;;; Copyright © 2020 Marius Bakke <mbakke@fastmail.com>
10 ;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
11 ;;; Copyright © 2020 Pjotr Prins <pjotr.guix@thebird.nl>
12 ;;; Copyright © 2021 Bonface Munyoki Kilyungi <me@bonfacemunyoki.com>
14 ;;; This file is part of GNU Guix.
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.
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.
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/>.
29 (define-module (gnu packages graphviz)
30 #:use-module (guix packages)
31 #:use-module (guix build-system gnu)
32 #:use-module (guix build-system python)
33 #:use-module (guix download)
34 #:use-module (guix git-download)
35 #:use-module (guix utils)
36 #:use-module (gnu packages)
37 #:use-module (gnu packages autotools)
38 #:use-module (gnu packages bison)
39 #:use-module (gnu packages check)
40 #:use-module (gnu packages compression)
41 #:use-module (gnu packages flex)
42 #:use-module (gnu packages fontutils)
43 #:use-module (gnu packages gd)
44 #:use-module (gnu packages glib)
45 #:use-module (gnu packages gnome)
46 #:use-module (gnu packages gtk)
47 #:use-module (gnu packages guile)
48 #:use-module (gnu packages image)
49 #:use-module (gnu packages perl)
50 #:use-module (gnu packages pkg-config)
51 #:use-module (gnu packages python)
52 #:use-module (gnu packages python-check)
53 #:use-module (gnu packages python-xyz)
54 #:use-module (gnu packages sphinx)
55 #:use-module (gnu packages swig)
56 #:use-module (gnu packages tcl)
57 #:use-module (gnu packages tex)
58 #:use-module (gnu packages xml)
59 #:use-module (gnu packages xorg)
60 #:use-module ((guix licenses) #:prefix license:))
62 (define-public graphviz
65 (replacement graphviz/fixed)
70 "https://www2.graphviz.org/Packages/stable/portable_source/"
71 "graphviz-" version ".tar.gz"))
74 "1pbswjbx3fjdlsxcm7cmlsl5bvaa3d6gcnr0cr8x3c8pag13zbwg"))))
75 (build-system gnu-build-system)
77 ;; FIXME: rtest/rtest.sh is a ksh script (!). Add ksh as an input.
80 (modify-phases %standard-phases
81 (add-after 'install 'move-docs
82 (lambda* (#:key outputs #:allow-other-keys)
83 (let ((out (assoc-ref outputs "out"))
84 (doc (assoc-ref outputs "doc")))
85 (mkdir-p (string-append doc "/share/graphviz"))
86 (rename-file (string-append out "/share/graphviz/doc")
87 (string-append doc "/share/graphviz/doc"))
89 (add-after 'move-docs 'move-guile-bindings
90 (lambda* (#:key outputs #:allow-other-keys)
91 (let* ((out (assoc-ref outputs "out"))
92 (lib (string-append out "/lib"))
93 (extdir (string-append lib
94 "/guile/2.0/extensions")))
96 (rename-file (string-append
97 lib "/graphviz/guile/libgv_guile.so")
102 `(("libXrender" ,libxrender)
105 ("gd" ,gd) ; FIXME: Our GD is too old
106 ("guile" ,guile-2.0) ;Guile bindings
108 ("fontconfig" ,fontconfig)
109 ("freetype" ,freetype)
113 ("libjpeg" ,libjpeg-turbo)
118 ("pkg-config" ,pkg-config)))
119 (outputs '("out" "doc")) ; 5 MiB of html + pdfs
120 (home-page "http://www.graphviz.org/")
121 (synopsis "Graph visualization software")
123 "Graphviz is a graph visualization tool suite. Graph visualization is a
124 way of representing structural information as diagrams of abstract graphs and
125 networks. It has important applications in networking, bioinformatics,
126 software engineering, database and web design, machine learning, and in visual
127 interfaces for other technical domains.")
128 (license license:epl1.0)))
130 (define-public graphviz/fixed
135 (inherit (package-source graphviz))
136 (patches (append (search-patches "graphviz-CVE-2020-18032.patch")
137 (origin-patches (package-source graphviz)))))))))
139 ;; Older Graphviz needed for pygraphviz. See
140 ;; https://github.com/pygraphviz/pygraphviz/issues/175
141 (define-public graphviz-2.38
142 ;; This commit corresponds to the changelog change for version 2.38.0.
143 ;; There are no tags.
144 (let ((commit "f54ac2c9313ae80ccf76ef4ac6aa9be820a23126")
146 (package (inherit graphviz)
148 (version (git-version "2.38.0" revision commit))
152 (url "https://gitlab.com/graphviz/graphviz.git")
154 (file-name (git-file-name name version))
157 "1vjg308gflmi1khgjmcj431cnkrlv12bg4cqah39mwhny92jy92x"))))
159 (substitute-keyword-arguments (package-arguments graphviz)
161 `(modify-phases ,phases
162 (add-after 'unpack 'prepare-bootstrap
164 (substitute* "autogen.sh"
165 (("/bin/sh") (which "sh"))
166 (("\\$GRAPHVIZ_VERSION_DATE") "0"))
167 (setenv "CONFIG_SHELL" (which "sh"))
168 (setenv "SHELL" (which "sh"))
170 (map make-file-writable (find-files "." ".*"))
173 (lambda _ (invoke (which "sh") "autogen.sh" "NOCONFIG") #t))))))
175 `(("autoconf" ,autoconf)
176 ("automake" ,automake)
181 ,@(package-native-inputs graphviz))))))
183 (define-public python-graphviz
185 (name "python-graphviz")
189 (uri (pypi-uri "graphviz" version ".zip"))
192 "009alrilzx0v7kl41khbq7k6k8b8pxyvbsi1b1ai933f6kpbxb30"))))
193 (build-system python-build-system)
195 '(#:phases (modify-phases %standard-phases
197 (lambda* (#:key tests #:allow-other-keys)
199 (invoke "pytest" "-vv")
200 (format #t "test suite not run~%"))
206 ("graphviz" ,graphviz)
207 ("python-mock" ,python-mock)
208 ("python-pytest" ,python-pytest)
209 ("python-pytest-cov" ,python-pytest-cov)
210 ("python-pytest-mock" ,python-pytest-mock)))
211 (home-page "https://github.com/xflr6/graphviz")
212 (synopsis "Simple Python interface for Graphviz")
214 "This package provides a simple Python interface for the Graphviz graph
215 visualization tool suite.")
216 (license license:expat)))
218 (define-public python2-graphviz
219 (package-with-python2 python-graphviz))
221 (define-public python-pygraphviz
223 (name "python-pygraphviz")
229 (url "https://github.com/pygraphviz/pygraphviz")
230 (commit (string-append "pygraphviz-" version))))
231 (file-name (string-append "pygraphviz-" version "-checkout"))
234 "1yldym38m8ckgflln83i88143pd9fjj1vfp23sq39fs6np5g0nzp"))))
235 (build-system python-build-system)
238 (let ((graphviz (assoc-ref %build-inputs "graphviz")))
239 (list (string-append "--include-path=" graphviz "/include")
240 (string-append "--library-path=" graphviz "/lib")))))
242 `(("graphviz" ,graphviz-2.38)))
244 `(("python-nose" ,python-nose)
245 ("python-mock" ,python-mock)
246 ("python-doctest-ignore-unicode" ,python-doctest-ignore-unicode)))
247 (home-page "https://pygraphviz.github.io")
248 (synopsis "Python interface to Graphviz")
249 (description "PyGraphviz is a Python interface to the Graphviz graph
250 layout and visualization package. With PyGraphviz you can create, edit, read,
251 write, and draw graphs using Python to access the Graphviz graph data
252 structure and layout algorithms.")
253 (license license:bsd-3)))
255 (define-public python2-pygraphviz
256 (package-with-python2 python-pygraphviz))
258 (define-public python-uqbar
260 (name "python-uqbar")
266 (url "https://github.com/josiah-wolf-oberholtzer/uqbar")
267 (commit (string-append "v" version))))
268 (file-name (git-file-name name version))
271 "0413nyhd8z8v3lvsgaghhafnyxg90fi1q80j1kbl21gpmpnc9a7n"))))
272 (build-system python-build-system)
275 (modify-phases %standard-phases
276 (add-after 'unpack 'patch
278 (substitute* "setup.py"
279 ;; Latest versions of sphink-rtd-theme require npm to build.
280 (("sphinx-rtd-theme >= 0.4.0") "sphinx-rtd-theme >= 0.2.4")
281 (("black == 19.10b0") "black >= 19.10b0"))
284 (lambda* (#:key tests? #:allow-other-keys)
286 (invoke "python" "-m" "pytest" "tests"))
289 `(("graphviz" ,graphviz)
290 ("python-flake8" ,python-flake8)
291 ("python-isort" ,python-isort)
292 ("python-mypy" ,python-mypy)
293 ("python-pytest" ,python-pytest)
294 ("python-pytest-cov" ,python-pytest-cov)))
296 `(("python-black" ,python-black)
297 ("python-sphinx" ,python-sphinx)
298 ("python-sphinx-rtd-theme" ,python-sphinx-rtd-theme)
299 ("python-unidecode" ,python-unidecode)))
300 (home-page "https://github.com/josiah-wolf-oberholtzer/uqbar")
301 (synopsis "Tools for building documentation with Sphinx, Graphviz and LaTeX")
303 "This package contains tools for building documentation with Sphinx,
304 Graphviz and LaTeX.")
305 (license license:expat)))
313 (uri (string-append "mirror://sourceforge/gts/gts/" version
314 "/gts-" version ".tar.gz"))
317 "07mqx09jxh8cv9753y2d2jsv7wp8vjmrd7zcfpbrddz3wc9kx705"))))
318 (build-system gnu-build-system)
321 (modify-phases %standard-phases
322 (add-before 'check 'pre-check
324 (chmod "test/boolean/test.sh" #o777)
327 ;; Some data files used by the test suite are missing.
328 ;; See <http://sourceforge.net/p/gts/bugs/41/>.
331 `(("pkg-config" ,pkg-config)))
333 ;; The gts.pc file has glib-2.0 as required.
335 (home-page "http://gts.sourceforge.net/")
337 ;; Note: Despite the name, this is not official GNU software.
338 (synopsis "Triangulated Surface Library")
340 "Library intended to provide a set of useful functions to deal with
341 3D surfaces meshed with interconnected triangles.")
342 (license license:lgpl2.0+)))
351 (uri (pypi-uri "xdot" version))
354 "0cr4rh7dz4dfzyxrk5pzhm0d15gkrgkfp3i5lw178xy81pc56p71"))))
355 (build-system python-build-system)
358 (modify-phases %standard-phases
359 ;; We wrap xdot, so that we don't propagate gtk+ and graphviz
360 (add-after 'install 'wrap
361 (lambda* (#:key inputs outputs #:allow-other-keys)
362 (wrap-program (string-append (assoc-ref outputs "out") "/bin/xdot")
363 `("GI_TYPELIB_PATH" ":" prefix
365 (assoc-ref inputs "gtk+") "/lib/girepository-1.0"
366 ":" (assoc-ref inputs "pango") "/lib/girepository-1.0"
367 ":" (assoc-ref inputs "gdk-pixbuf") "/lib/girepository-1.0"
368 ":" (assoc-ref inputs "atk") "/lib/girepository-1.0")))
370 (,(string-append (assoc-ref inputs "graphviz") "/bin"))))
374 ("gdk-pixbuf" ,gdk-pixbuf+svg)
375 ("graphviz" ,graphviz)
377 ("python-pycairo" ,python-pycairo)
378 ("python-pygobject" ,python-pygobject)))
379 (home-page "https://pypi.org/project/xdot/")
380 (synopsis "Interactive viewer for graphviz dot files")
381 (description "Xdot is an interactive viewer for graphs written in
382 @code{graphviz}’s dot language. Internally, it uses the xdot output format as
383 an intermediate format, and @code{gtk} and @code{cairo} for rendering. Xdot
384 can be used either as a standalone application, or as a Python library.")
385 (license license:lgpl3+)))
387 (define-public python-pydot
389 (name "python-pydot")
394 (uri (pypi-uri "pydot" version))
397 "00az4cbf8bv447lkk9xi6pjm7gcc7ia33y4pm71fwfwis56rv76l"))
398 (patches (search-patches "python-pydot-regression-test.patch"))))
399 (build-system python-build-system)
402 (modify-phases %standard-phases
404 ;; Taken from .travis.yaml
405 (lambda* (#:key tests? inputs outputs #:allow-other-keys)
407 (add-installed-pythonpath inputs outputs)
408 (with-directory-excursion "test"
409 (invoke "python" "pydot_unittest.py")))
413 `(("graphviz" ,graphviz)
414 ("python-chardet" ,python-chardet)))
416 `(("python-pyparsing" ,python-pyparsing)))
417 (home-page "https://github.com/pydot/pydot")
418 (synopsis "Python interface to Graphviz's DOT language")
420 "Pydot provides an interface to create, handle, modify and process
421 graphs in Graphviz's DOT language, written in pure Python.")
422 (license license:expat)))
424 (define-public python2-pydot
425 (package-with-python2 python-pydot))
427 (define-public dot2tex
433 (uri (pypi-uri "dot2tex" version))
436 "1kp77wiv7b5qib82i3y3sn9r49rym43aaqm5aw1bwnzfbbq2m6i9"))))
437 (build-system python-build-system)
439 `(#:python ,python-2))
441 `(("texlive-latex-preview" ,texlive-latex-preview)
442 ("graphviz" ,graphviz)))
444 `(("python-pyparsing" ,python2-pyparsing)))
445 (home-page "https://github.com/kjellmf/dot2tex")
446 (synopsis "Graphviz to LaTeX converter")
448 "The purpose of @code{dot2tex} is to give graphs generated by Graphviz a
449 more LaTeX friendly look and feel. This is accomplished by converting
450 @code{xdot} output from Graphviz to a series of PSTricks or PGF/TikZ commands.
451 This approach allows:
454 @item Typesetting labels with LaTeX, allowing mathematical notation
455 @item Using native PSTricks and PGF/TikZ commands for drawing arrows
456 @item Using backend specific styles to customize the output
458 (license license:expat)))