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