1{
2 lib,
3 stdenv,
4 pkgs,
5 buildPythonPackage,
6 setuptools,
7 numpy,
8 pip,
9
10 mpiSupport ? false,
11}:
12let
13 conduit = pkgs.conduit.override { inherit mpiSupport; };
14in
15buildPythonPackage {
16 inherit (conduit)
17 pname
18 version
19 src
20 nativeBuildInputs
21 buildInputs
22 ;
23 pyproject = true;
24
25 # Needed for cmake to find openmpi
26 strictDeps = false;
27
28 postPatch = ''
29 substituteInPlace setup.py \
30 --replace-fail \
31 "'-j2'" \
32 "f'-j{os.environ.get(\"NIX_BUILD_CORES\")}'"
33 '';
34
35 dontUseCmakeConfigure = true;
36
37 env.ENABLE_MPI = mpiSupport;
38
39 build-system = [
40 setuptools
41 ];
42
43 dependencies = [
44 numpy
45 pip
46 ];
47
48 pythonImportsCheck = [ "conduit" ];
49
50 # No python tests
51 doCheck = false;
52
53 meta = {
54 description = "Python bindings for the conduit library";
55 inherit (conduit.meta)
56 homepage
57 changelog
58 license
59 platforms
60 ;
61 maintainers = with lib.maintainers; [ GaetanLepage ];
62 # Cross-compilation is broken
63 broken = stdenv.hostPlatform != stdenv.buildPlatform;
64 };
65}