summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/conduit/default.nix
blob: 9fd15ff2eea0299cd034647ac8ea8d3e70da2505 (plain)
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
63
64
65
{
  lib,
  stdenv,
  pkgs,
  buildPythonPackage,
  setuptools,
  numpy,
  pip,

  mpiSupport ? false,
}:
let
  conduit = pkgs.conduit.override { inherit mpiSupport; };
in
buildPythonPackage {
  inherit (conduit)
    pname
    version
    src
    nativeBuildInputs
    buildInputs
    ;
  pyproject = true;

  # Needed for cmake to find openmpi
  strictDeps = false;

  postPatch = ''
    substituteInPlace setup.py \
      --replace-fail \
        "'-j2'" \
        "f'-j{os.environ.get(\"NIX_BUILD_CORES\")}'"
  '';

  dontUseCmakeConfigure = true;

  env.ENABLE_MPI = mpiSupport;

  build-system = [
    setuptools
  ];

  dependencies = [
    numpy
    pip
  ];

  pythonImportsCheck = [ "conduit" ];

  # No python tests
  doCheck = false;

  meta = {
    description = "Python bindings for the conduit library";
    inherit (conduit.meta)
      homepage
      changelog
      license
      platforms
      ;
    maintainers = with lib.maintainers; [ GaetanLepage ];
    # Cross-compilation is broken
    broken = stdenv.hostPlatform != stdenv.buildPlatform;
  };
}