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
69 "https://www2.graphviz.org/Packages/stable/portable_source/"
70 "graphviz-" version ".tar.gz"))
73 "1pbswjbx3fjdlsxcm7cmlsl5bvaa3d6gcnr0cr8x3c8pag13zbwg"))))
74 (build-system gnu-build-system)
76 ;; FIXME: rtest/rtest.sh is a ksh script (!). Add ksh as an input.
79 (modify-phases %standard-phases
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"))
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")))
95 (rename-file (string-append
96 lib "/graphviz/guile/libgv_guile.so")
101 `(("libXrender" ,libxrender)
104 ("gd" ,gd) ; FIXME: Our GD is too old
105 ("guile" ,guile-2.0) ;Guile bindings
107 ("fontconfig" ,fontconfig)
108 ("freetype" ,freetype)
112 ("libjpeg" ,libjpeg-turbo)
117 ("pkg-config" ,pkg-config)))
118 (outputs '("out" "doc")) ; 5 MiB of html + pdfs
119 (home-page "http://www.graphviz.org/")
120 (synopsis "Graph visualization software")
122 "Graphviz is a graph visualization tool suite. Graph visualization is a
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.")
127 (license license:epl1.0)))
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")
136 (package (inherit graphviz)
138 (version (git-version "2.38.0" revision commit))
142 (url "https://gitlab.com/graphviz/graphviz.git")
144 (file-name (git-file-name name version))
147 "1vjg308gflmi1khgjmcj431cnkrlv12bg4cqah39mwhny92jy92x"))))
149 (substitute-keyword-arguments (package-arguments graphviz)
151 `(modify-phases ,phases
152 (add-after 'unpack 'prepare-bootstrap
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"))
160 (map make-file-writable (find-files "." ".*"))
163 (lambda _ (invoke (which "sh") "autogen.sh" "NOCONFIG") #t))))))
165 `(("autoconf" ,autoconf)
166 ("automake" ,automake)
171 ,@(package-native-inputs graphviz))))))
173 (define-public python-graphviz
175 (name "python-graphviz")
179 (uri (pypi-uri "graphviz" version ".zip"))
182 "009alrilzx0v7kl41khbq7k6k8b8pxyvbsi1b1ai933f6kpbxb30"))))
183 (build-system python-build-system)
185 '(#:phases (modify-phases %standard-phases
187 (lambda* (#:key tests #:allow-other-keys)
189 (invoke "pytest" "-vv")
190 (format #t "test suite not run~%"))
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)))
201 (home-page "https://github.com/xflr6/graphviz")
202 (synopsis "Simple Python interface for Graphviz")
204 "This package provides a simple Python interface for the Graphviz graph
205 visualization tool suite.")
206 (license license:expat)))
208 (define-public python2-graphviz
209 (package-with-python2 python-graphviz))
211 (define-public python-pygraphviz
213 (name "python-pygraphviz")
219 (url "https://github.com/pygraphviz/pygraphviz")
220 (commit (string-append "pygraphviz-" version))))
221 (file-name (string-append "pygraphviz-" version "-checkout"))
224 "1yldym38m8ckgflln83i88143pd9fjj1vfp23sq39fs6np5g0nzp"))))
225 (build-system python-build-system)
228 (let ((graphviz (assoc-ref %build-inputs "graphviz")))
229 (list (string-append "--include-path=" graphviz "/include")
230 (string-append "--library-path=" graphviz "/lib")))))
232 `(("graphviz" ,graphviz-2.38)))
234 `(("python-nose" ,python-nose)
235 ("python-mock" ,python-mock)
236 ("python-doctest-ignore-unicode" ,python-doctest-ignore-unicode)))
237 (home-page "https://pygraphviz.github.io")
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)))
245 (define-public python2-pygraphviz
246 (package-with-python2 python-pygraphviz))
248 (define-public python-uqbar
250 (name "python-uqbar")
256 (url "https://github.com/josiah-wolf-oberholtzer/uqbar")
257 (commit (string-append "v" version))))
258 (file-name (git-file-name name version))
261 "0413nyhd8z8v3lvsgaghhafnyxg90fi1q80j1kbl21gpmpnc9a7n"))))
262 (build-system python-build-system)
265 (modify-phases %standard-phases
266 (add-after 'unpack 'patch
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"))
274 (lambda* (#:key tests? #:allow-other-keys)
276 (invoke "python" "-m" "pytest" "tests"))
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)))
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")
293 "This package contains tools for building documentation with Sphinx,
294 Graphviz and LaTeX.")
295 (license license:expat)))
303 (uri (string-append "mirror://sourceforge/gts/gts/" version
304 "/gts-" version ".tar.gz"))
307 "07mqx09jxh8cv9753y2d2jsv7wp8vjmrd7zcfpbrddz3wc9kx705"))))
308 (build-system gnu-build-system)
311 (modify-phases %standard-phases
312 (add-before 'check 'pre-check
314 (chmod "test/boolean/test.sh" #o777)
317 ;; Some data files used by the test suite are missing.
318 ;; See <http://sourceforge.net/p/gts/bugs/41/>.
321 `(("pkg-config" ,pkg-config)))
323 ;; The gts.pc file has glib-2.0 as required.
325 (home-page "http://gts.sourceforge.net/")
327 ;; Note: Despite the name, this is not official GNU software.
328 (synopsis "Triangulated Surface Library")
330 "Library intended to provide a set of useful functions to deal with
331 3D surfaces meshed with interconnected triangles.")
332 (license license:lgpl2.0+)))
341 (uri (pypi-uri "xdot" version))
344 "0cr4rh7dz4dfzyxrk5pzhm0d15gkrgkfp3i5lw178xy81pc56p71"))))
345 (build-system python-build-system)
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
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")))
360 (,(string-append (assoc-ref inputs "graphviz") "/bin"))))
364 ("gdk-pixbuf" ,gdk-pixbuf+svg)
365 ("graphviz" ,graphviz)
367 ("python-pycairo" ,python-pycairo)
368 ("python-pygobject" ,python-pygobject)))
369 (home-page "https://pypi.org/project/xdot/")
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
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.")
375 (license license:lgpl3+)))
377 (define-public python-pydot
379 (name "python-pydot")
384 (uri (pypi-uri "pydot" version))
387 "00az4cbf8bv447lkk9xi6pjm7gcc7ia33y4pm71fwfwis56rv76l"))
388 (patches (search-patches "python-pydot-regression-test.patch"))))
389 (build-system python-build-system)
392 (modify-phases %standard-phases
394 ;; Taken from .travis.yaml
395 (lambda* (#:key tests? inputs outputs #:allow-other-keys)
397 (add-installed-pythonpath inputs outputs)
398 (with-directory-excursion "test"
399 (invoke "python" "pydot_unittest.py")))
403 `(("graphviz" ,graphviz)
404 ("python-chardet" ,python-chardet)))
406 `(("python-pyparsing" ,python-pyparsing)))
407 (home-page "https://github.com/pydot/pydot")
408 (synopsis "Python interface to Graphviz's DOT language")
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)))
414 (define-public python2-pydot
415 (package-with-python2 python-pydot))
417 (define-public dot2tex
423 (uri (pypi-uri "dot2tex" version))
426 "1kp77wiv7b5qib82i3y3sn9r49rym43aaqm5aw1bwnzfbbq2m6i9"))))
427 (build-system python-build-system)
429 `(#:python ,python-2))
431 `(("texlive-latex-preview" ,texlive-latex-preview)
432 ("graphviz" ,graphviz)))
434 `(("python-pyparsing" ,python2-pyparsing)))
435 (home-page "https://github.com/kjellmf/dot2tex")
436 (synopsis "Graphviz to LaTeX converter")
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:
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
448 (license license:expat)))