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>
13 ;;; This file is part of GNU Guix.
15 ;;; GNU Guix is free software; you can redistribute it and/or modify it
16 ;;; under the terms of the GNU General Public License as published by
17 ;;; the Free Software Foundation; either version 3 of the License, or (at
18 ;;; your option) any later version.
20 ;;; GNU Guix is distributed in the hope that it will be useful, but
21 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
22 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 ;;; GNU General Public License for more details.
25 ;;; You should have received a copy of the GNU General Public License
26 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
28 (define-module (gnu packages graphviz)
29 #:use-module (guix packages)
30 #:use-module (guix build-system gnu)
31 #:use-module (guix build-system python)
32 #:use-module (guix download)
33 #:use-module (guix git-download)
34 #:use-module (guix utils)
35 #:use-module (gnu packages)
36 #:use-module (gnu packages autotools)
37 #:use-module (gnu packages bison)
38 #:use-module (gnu packages check)
39 #:use-module (gnu packages compression)
40 #:use-module (gnu packages flex)
41 #:use-module (gnu packages fontutils)
42 #:use-module (gnu packages gd)
43 #:use-module (gnu packages glib)
44 #:use-module (gnu packages gnome)
45 #:use-module (gnu packages gtk)
46 #:use-module (gnu packages guile)
47 #:use-module (gnu packages image)
48 #:use-module (gnu packages perl)
49 #:use-module (gnu packages pkg-config)
50 #:use-module (gnu packages python)
51 #:use-module (gnu packages python-xyz)
52 #:use-module (gnu packages swig)
53 #:use-module (gnu packages tcl)
54 #:use-module (gnu packages tex)
55 #:use-module (gnu packages xml)
56 #:use-module (gnu packages xorg)
57 #:use-module ((guix licenses) #:prefix license:))
59 (define-public graphviz
66 "https://www2.graphviz.org/Packages/stable/portable_source/"
67 "graphviz-" version ".tar.gz"))
70 "1pbswjbx3fjdlsxcm7cmlsl5bvaa3d6gcnr0cr8x3c8pag13zbwg"))))
71 (build-system gnu-build-system)
73 ;; FIXME: rtest/rtest.sh is a ksh script (!). Add ksh as an input.
76 (modify-phases %standard-phases
77 (add-after 'install 'move-docs
78 (lambda* (#:key outputs #:allow-other-keys)
79 (let ((out (assoc-ref outputs "out"))
80 (doc (assoc-ref outputs "doc")))
81 (mkdir-p (string-append doc "/share/graphviz"))
82 (rename-file (string-append out "/share/graphviz/doc")
83 (string-append doc "/share/graphviz/doc"))
85 (add-after 'move-docs 'move-guile-bindings
86 (lambda* (#:key outputs #:allow-other-keys)
87 (let* ((out (assoc-ref outputs "out"))
88 (lib (string-append out "/lib"))
89 (extdir (string-append lib
90 "/guile/2.0/extensions")))
92 (rename-file (string-append
93 lib "/graphviz/guile/libgv_guile.so")
98 `(("libXrender" ,libxrender)
101 ("gd" ,gd) ; FIXME: Our GD is too old
102 ("guile" ,guile-2.0) ;Guile bindings
104 ("fontconfig" ,fontconfig)
105 ("freetype" ,freetype)
109 ("libjpeg" ,libjpeg-turbo)
114 ("pkg-config" ,pkg-config)))
115 (outputs '("out" "doc")) ; 5 MiB of html + pdfs
116 (home-page "http://www.graphviz.org/")
117 (synopsis "Graph visualization software")
119 "Graphviz is a graph visualization tool suite. Graph visualization is a
120 way of representing structural information as diagrams of abstract graphs and
121 networks. It has important applications in networking, bioinformatics,
122 software engineering, database and web design, machine learning, and in visual
123 interfaces for other technical domains.")
124 (license license:epl1.0)))
126 ;; Older Graphviz needed for pygraphviz. See
127 ;; https://github.com/pygraphviz/pygraphviz/issues/175
128 (define-public graphviz-2.38
129 ;; This commit corresponds to the changelog change for version 2.38.0.
130 ;; There are no tags.
131 (let ((commit "f54ac2c9313ae80ccf76ef4ac6aa9be820a23126")
133 (package (inherit graphviz)
135 (version (git-version "2.38.0" revision commit))
139 (url "https://gitlab.com/graphviz/graphviz.git")
141 (file-name (git-file-name name version))
144 "1vjg308gflmi1khgjmcj431cnkrlv12bg4cqah39mwhny92jy92x"))))
146 (substitute-keyword-arguments (package-arguments graphviz)
148 `(modify-phases ,phases
149 (add-after 'unpack 'prepare-bootstrap
151 (substitute* "autogen.sh"
152 (("/bin/sh") (which "sh"))
153 (("\\$GRAPHVIZ_VERSION_DATE") "0"))
154 (setenv "CONFIG_SHELL" (which "sh"))
155 (setenv "SHELL" (which "sh"))
157 (map make-file-writable (find-files "." ".*"))
160 (lambda _ (invoke (which "sh") "autogen.sh" "NOCONFIG") #t))))))
162 `(("autoconf" ,autoconf)
163 ("automake" ,automake)
168 ,@(package-native-inputs graphviz))))))
170 (define-public python-graphviz
172 (name "python-graphviz")
176 (uri (pypi-uri "graphviz" version ".zip"))
179 "009alrilzx0v7kl41khbq7k6k8b8pxyvbsi1b1ai933f6kpbxb30"))))
180 (build-system python-build-system)
182 '(#:phases (modify-phases %standard-phases
184 (lambda* (#:key tests #:allow-other-keys)
186 (invoke "pytest" "-vv")
187 (format #t "test suite not run~%"))
193 ("graphviz" ,graphviz)
194 ("python-mock" ,python-mock)
195 ("python-pytest" ,python-pytest)
196 ("python-pytest-cov" ,python-pytest-cov)
197 ("python-pytest-mock" ,python-pytest-mock)))
198 (home-page "https://github.com/xflr6/graphviz")
199 (synopsis "Simple Python interface for Graphviz")
201 "This package provides a simple Python interface for the Graphviz graph
202 visualization tool suite.")
203 (license license:expat)))
205 (define-public python2-graphviz
206 (package-with-python2 python-graphviz))
208 (define-public python-pygraphviz
210 (name "python-pygraphviz")
216 (url "https://github.com/pygraphviz/pygraphviz")
217 (commit (string-append "pygraphviz-" version))))
218 (file-name (string-append "pygraphviz-" version "-checkout"))
221 "1yldym38m8ckgflln83i88143pd9fjj1vfp23sq39fs6np5g0nzp"))))
222 (build-system python-build-system)
225 (let ((graphviz (assoc-ref %build-inputs "graphviz")))
226 (list (string-append "--include-path=" graphviz "/include")
227 (string-append "--library-path=" graphviz "/lib")))))
229 `(("graphviz" ,graphviz-2.38)))
231 `(("python-nose" ,python-nose)
232 ("python-mock" ,python-mock)
233 ("python-doctest-ignore-unicode" ,python-doctest-ignore-unicode)))
234 (home-page "https://pygraphviz.github.io")
235 (synopsis "Python interface to Graphviz")
236 (description "PyGraphviz is a Python interface to the Graphviz graph
237 layout and visualization package. With PyGraphviz you can create, edit, read,
238 write, and draw graphs using Python to access the Graphviz graph data
239 structure and layout algorithms.")
240 (license license:bsd-3)))
242 (define-public python2-pygraphviz
243 (package-with-python2 python-pygraphviz))
251 (uri (string-append "mirror://sourceforge/gts/gts/" version
252 "/gts-" version ".tar.gz"))
255 "07mqx09jxh8cv9753y2d2jsv7wp8vjmrd7zcfpbrddz3wc9kx705"))))
256 (build-system gnu-build-system)
259 (modify-phases %standard-phases
260 (add-before 'check 'pre-check
262 (chmod "test/boolean/test.sh" #o777)
265 ;; Some data files used by the test suite are missing.
266 ;; See <http://sourceforge.net/p/gts/bugs/41/>.
269 `(("pkg-config" ,pkg-config)))
271 ;; The gts.pc file has glib-2.0 as required.
273 (home-page "http://gts.sourceforge.net/")
275 ;; Note: Despite the name, this is not official GNU software.
276 (synopsis "Triangulated Surface Library")
278 "Library intended to provide a set of useful functions to deal with
279 3D surfaces meshed with interconnected triangles.")
280 (license license:lgpl2.0+)))
289 (uri (pypi-uri "xdot" version))
292 "0cr4rh7dz4dfzyxrk5pzhm0d15gkrgkfp3i5lw178xy81pc56p71"))))
293 (build-system python-build-system)
296 (modify-phases %standard-phases
297 ;; We wrap xdot, so that we don't propagate gtk+ and graphviz
298 (add-after 'install 'wrap
299 (lambda* (#:key inputs outputs #:allow-other-keys)
300 (wrap-program (string-append (assoc-ref outputs "out") "/bin/xdot")
301 `("GI_TYPELIB_PATH" ":" prefix
303 (assoc-ref inputs "gtk+") "/lib/girepository-1.0"
304 ":" (assoc-ref inputs "pango") "/lib/girepository-1.0"
305 ":" (assoc-ref inputs "gdk-pixbuf") "/lib/girepository-1.0"
306 ":" (assoc-ref inputs "atk") "/lib/girepository-1.0")))
308 (,(string-append (assoc-ref inputs "graphviz") "/bin"))))
312 ("gdk-pixbuf" ,gdk-pixbuf+svg)
313 ("graphviz" ,graphviz)
315 ("python-pycairo" ,python-pycairo)
316 ("python-pygobject" ,python-pygobject)))
317 (home-page "https://pypi.org/project/xdot/")
318 (synopsis "Interactive viewer for graphviz dot files")
319 (description "Xdot is an interactive viewer for graphs written in
320 @code{graphviz}’s dot language. Internally, it uses the xdot output format as
321 an intermediate format, and @code{gtk} and @code{cairo} for rendering. Xdot
322 can be used either as a standalone application, or as a Python library.")
323 (license license:lgpl3+)))
325 (define-public python-pydot
327 (name "python-pydot")
332 (uri (pypi-uri "pydot" version))
335 "00az4cbf8bv447lkk9xi6pjm7gcc7ia33y4pm71fwfwis56rv76l"))
336 (patches (search-patches "python-pydot-regression-test.patch"))))
337 (build-system python-build-system)
340 (modify-phases %standard-phases
342 ;; Taken from .travis.yaml
343 (lambda* (#:key tests? inputs outputs #:allow-other-keys)
345 (add-installed-pythonpath inputs outputs)
346 (with-directory-excursion "test"
347 (invoke "python" "pydot_unittest.py")))
351 `(("graphviz" ,graphviz)
352 ("python-chardet" ,python-chardet)))
354 `(("python-pyparsing" ,python-pyparsing)))
355 (home-page "https://github.com/pydot/pydot")
356 (synopsis "Python interface to Graphviz's DOT language")
358 "Pydot provides an interface to create, handle, modify and process
359 graphs in Graphviz's DOT language, written in pure Python.")
360 (license license:expat)))
362 (define-public python2-pydot
363 (package-with-python2 python-pydot))
365 (define-public dot2tex
371 (uri (pypi-uri "dot2tex" version))
374 "1kp77wiv7b5qib82i3y3sn9r49rym43aaqm5aw1bwnzfbbq2m6i9"))))
375 (build-system python-build-system)
377 `(#:python ,python-2))
379 `(("texlive-latex-preview" ,texlive-latex-preview)
380 ("graphviz" ,graphviz)))
382 `(("python-pyparsing" ,python2-pyparsing)))
383 (home-page "https://github.com/kjellmf/dot2tex")
384 (synopsis "Graphviz to LaTeX converter")
386 "The purpose of @code{dot2tex} is to give graphs generated by Graphviz a
387 more LaTeX friendly look and feel. This is accomplished by converting
388 @code{xdot} output from Graphviz to a series of PSTricks or PGF/TikZ commands.
389 This approach allows:
392 @item Typesetting labels with LaTeX, allowing mathematical notation
393 @item Using native PSTricks and PGF/TikZ commands for drawing arrows
394 @item Using backend specific styles to customize the output
396 (license license:expat)))