1{ lib
2, apptools
3, buildPythonPackage
4, envisage
5, fetchPypi
6, fetchpatch
7, numpy
8, packaging
9, pyface
10, pygments
11, pyqt5
12, pythonOlder
13, pythonAtLeast
14, traitsui
15, vtk
16, wrapQtAppsHook
17}:
18
19buildPythonPackage rec {
20 pname = "mayavi";
21 version = "4.8.1";
22 format = "setuptools";
23 disabled = pythonOlder "3.8" || pythonAtLeast "3.11";
24
25 src = fetchPypi {
26 inherit pname version;
27 hash = "sha256-n0J+8spska542S02ibpr7KJMhGDicG2KHJuEKJrT/Z4=";
28 };
29
30 patches = [
31 # Adds compatibility with Python 3.11.
32 # https://github.com/enthought/mayavi/pull/1199
33 (fetchpatch {
34 name = "python311-compat.patch";
35 url = "https://github.com/enthought/mayavi/commit/50c0cbfcf97560be69c84b7c924635a558ebf92f.patch";
36 hash = "sha256-zZOT6on/f5cEjnDBrNGog/wPQh7rBkaFqrxkBYDUQu0=";
37 includes = [ "tvtk/src/*" ];
38 })
39 # Fixes an incompatible function pointer conversion error
40 # https://github.com/enthought/mayavi/pull/1266
41 (fetchpatch {
42 name = "incompatible-pointer-conversion.patch";
43 url = "https://github.com/enthought/mayavi/commit/887adc8fe2b076a368070f5b1d564745b03b1964.patch";
44 hash = "sha256-88H1NNotd4pO0Zw1oLrYk5WNuuVrmTU01HJgsTRfKlo=";
45 })
46 ];
47
48 postPatch = ''
49 # building the docs fails with the usual Qt xcb error, so skip:
50 substituteInPlace setup.py \
51 --replace "build.build.run(self)" "build.build.run(self); return"
52 '';
53
54 nativeBuildInputs = [
55 wrapQtAppsHook
56 ];
57
58 propagatedBuildInputs = [
59 apptools
60 envisage
61 numpy
62 packaging
63 pyface
64 pygments
65 pyqt5
66 traitsui
67 vtk
68 ];
69
70 env.NIX_CFLAGS_COMPILE = "-Wno-error";
71
72 # Needs X server
73 doCheck = false;
74
75 pythonImportsCheck = [
76 "mayavi"
77 ];
78
79 preFixup = ''
80 makeWrapperArgs+=("''${qtWrapperArgs[@]}")
81 '';
82
83 meta = with lib; {
84 description = "3D visualization of scientific data in Python";
85 homepage = "https://github.com/enthought/mayavi";
86 license = licenses.bsdOriginal;
87 maintainers = with maintainers; [ knedlsepp ];
88 };
89}