about summary refs log tree commit diff
path: root/pkgs/development/python-modules/scikit-fmm/default.nix
blob: b5ee709b7f62de6e078d3e530511c53222097a75 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
{
  lib,
  buildPythonPackage,
  fetchpatch,
  fetchPypi,
  meson-python,
  numpy,
  python,
}:

buildPythonPackage rec {
  pname = "scikit-fmm";
  version = "2023.4.2";
  pyproject = true;

  src = fetchPypi {
    inherit pname version;
    hash = "sha256-14ccR/ggdyq6kvJWUe8U5NJ96M45PArjwCqzxuJCPAs=";
  };

  # TODO: Remove these patches after another stable release is made.
  # For now, these allow us to build with Python 3.12+ by switching to Meson
  # and off the deprecated distutils.
  patches = [
    (fetchpatch {
      name = "first-try-at-meson-build.patch";
      hash = "sha256-Kclg4YrQZL6ZSVsLh6X6DqdztPjDK35L5dp5PqYjzaY=";
      url = "https://github.com/scikit-fmm/scikit-fmm/commit/a52c0eccb70077553607a5084152316d136b668b.patch";
    })
    (fetchpatch {
      name = "work-in-progress-on-meson-build.patch";
      hash = "sha256-WvSwBz7exqe1H+CqdoMfT5jEoIHnyt/nbc/CryuEKiA=";
      url = "https://github.com/scikit-fmm/scikit-fmm/commit/db0e7a5f51541745027c3d081d7841e74587793e.patch";
    })
    (fetchpatch {
      name = "re-cythonize-the-heap-wrapper.patch";
      hash = "sha256-ro97+06R0szXQ9I8/sR4JAnFxoQwJeiImDcl1Yp9P0Y=";
      url = "https://github.com/scikit-fmm/scikit-fmm/commit/4168323e209343facd5f6ba93a85893242e781a2.patch";
    })
  ];

  postPatch = ''
    substituteInPlace pyproject.toml \
      --replace-fail "oldest-supported-numpy" "numpy"
  '';

  build-system = [ meson-python ];

  dependencies = [ numpy ];

  checkPhase = ''
    mkdir testdir; cd testdir
    ${python.interpreter} -c "import skfmm, sys; sys.exit(skfmm.test())"
  '';

  meta = with lib; {
    description = "Python extension module which implements the fast marching method";
    homepage = "https://github.com/scikit-fmm/scikit-fmm";
    license = licenses.bsd3;
    maintainers = with maintainers; [ ];
  };
}