1{ stdenv, fetchurl, python, cairomm, sparsehash, pycairo, autoreconfHook
2, pkgconfig, boost, expat, scipy, cgal, gmp, mpfr
3, gobject-introspection, pygobject3, gtk3, matplotlib, ncurses
4, buildPythonPackage
5, fetchpatch
6, pythonAtLeast
7, lib
8}:
9
10buildPythonPackage rec {
11 pname = "graph-tool";
12 format = "other";
13 version = "2.27";
14
15 meta = with stdenv.lib; {
16 description = "Python module for manipulation and statistical analysis of graphs";
17 homepage = https://graph-tool.skewed.de/;
18 license = licenses.gpl3;
19 maintainers = [ stdenv.lib.maintainers.joelmo ];
20 };
21
22 src = fetchurl {
23 url = "https://downloads.skewed.de/graph-tool/graph-tool-${version}.tar.bz2";
24 sha256 = "04s31qwlfcl7bwsggnic8gqcqmx2wsrmfw77nf7vzgnz42bwch27";
25 };
26
27 patches = [
28 # fix build with cgal 4.13 (https://git.skewed.de/count0/graph-tool/issues/509)
29 (fetchpatch {
30 name = "cgal-4.13.patch";
31 url = "https://git.skewed.de/count0/graph-tool/commit/aa39e4a6b42d43fac30c841d176c75aff92cc01a.patch";
32 sha256 = "1578inb4jqwq2fhhwscn5z95nzmaxvmvk30nzs5wirr26iznap4m";
33 })
34 ] ++ (lib.optionals (pythonAtLeast "3.7") [
35 # # python 3.7 compatibility (`async` is now reserved)
36 (fetchpatch {
37 name = "async-reserved.patch";
38 url = "https://git.skewed.de/count0/graph-tool/commit/0407f41a35b6be7c670927fb5dc578cbd0e88be4.patch";
39 sha256 = "1fklznhmfvbb3ykwzyf8p2hiczby6y7r0xnkkjl2jkxlvr24000q";
40 })
41 ]);
42
43 configureFlags = [
44 "--with-python-module-path=$(out)/${python.sitePackages}"
45 "--with-boost-libdir=${boost}/lib"
46 "--with-expat=${expat}"
47 "--with-cgal=${cgal}"
48 "--enable-openmp"
49 ];
50
51 nativeBuildInputs = [ autoreconfHook pkgconfig ];
52 buildInputs = [ ncurses ];
53
54 propagatedBuildInputs = [
55 boost
56 cgal
57 expat
58 gmp
59 mpfr
60 python
61 scipy
62 # optional
63 sparsehash
64 # drawing
65 cairomm
66 gobject-introspection
67 gtk3
68 pycairo
69 matplotlib
70 pygobject3
71 ];
72
73 enableParallelBuilding = false;
74}