3 files changed +79
-0
lines changed Original file line number Diff line number Diff line change 7
7
8
8
# passthru
9
9
conduit ,
10
+ python3Packages ,
10
11
nix-update-script ,
11
12
12
13
mpiSupport ? false ,
@@ -50,6 +51,8 @@ stdenv.mkDerivation (finalAttrs: {
50
51
passthru = {
51
52
tests = {
52
53
withMpi = conduit . override { mpiSupport = true ; } ;
54
+ pythonModule = python3Packages . conduit ;
55
+ pythonModuleWithMpi = python3Packages . conduit . override { mpiSupport = true ; } ;
53
56
} ;
54
57
updateScript = nix-update-script { } ;
55
58
} ;
Original file line number Diff line number Diff line change
1
+ {
2
+ lib ,
3
+ pkgs ,
4
+ buildPythonPackage ,
5
+ setuptools ,
6
+ numpy ,
7
+ pip ,
8
+ openmpi ,
9
+
10
+ mpiSupport ? false ,
11
+ } :
12
+ let
13
+ conduit = pkgs . conduit . override { inherit mpiSupport ; } ;
14
+
15
+ # As cmake is invoked by setup.py, adding openmpi to buildInputs is not enough for it to be found.
16
+ # It is necessary to explicitly provide openmpi's location through cmake flags.
17
+ mpi = lib . getDev openmpi ;
18
+ mpiCmakeFlags = lib . concatStringsSep "', '" [
19
+ ( lib . cmakeFeature "MPI_C_COMPILER" ( lib . getExe' mpi "mpicc" ) )
20
+ ( lib . cmakeFeature "MPI_CXX_COMPILER" ( lib . getExe' mpi "mpicxx" ) )
21
+ ] ;
22
+ in
23
+ buildPythonPackage {
24
+ inherit ( conduit )
25
+ pname
26
+ version
27
+ src
28
+ nativeBuildInputs
29
+ buildInputs
30
+ ;
31
+
32
+ postPatch =
33
+ ''
34
+ substituteInPlace setup.py \
35
+ --replace-fail \
36
+ "'-j2'" \
37
+ "f'-j{os.environ.get(\"NIX_BUILD_CORES\")}'"
38
+ ''
39
+ + lib . optionalString mpiSupport ''
40
+ substituteInPlace setup.py \
41
+ --replace-fail \
42
+ "cmake_args = [" \
43
+ "cmake_args = ['${ mpiCmakeFlags } ', "
44
+ '' ;
45
+
46
+ pyproject = true ;
47
+ dontUseCmakeConfigure = true ;
48
+
49
+ env . ENABLE_MPI = mpiSupport ;
50
+
51
+ build-system = [
52
+ setuptools
53
+ numpy
54
+ pip
55
+ ] ;
56
+
57
+ pythonImportsCheck = [ "conduit" ] ;
58
+
59
+ # No python tests
60
+ doCheck = false ;
61
+
62
+ meta = {
63
+ description = "Python bindings for the conduit library" ;
64
+ inherit ( conduit . meta )
65
+ homepage
66
+ changelog
67
+ license
68
+ platforms
69
+ ;
70
+ maintainers = with lib . maintainers ; [ GaetanLepage ] ;
71
+ } ;
72
+ }
Original file line number Diff line number Diff line change @@ -2646,6 +2646,10 @@ self: super: with self; {
2646
2646
2647
2647
conda-package-streaming = callPackage ../development/python-modules/conda-package-streaming { };
2648
2648
2649
+ conduit = callPackage ../development/python-modules/conduit { };
2650
+
2651
+ conduit-mpi = callPackage ../development/python-modules/conduit { mpiSupport = true; };
2652
+
2649
2653
confection = callPackage ../development/python-modules/confection { };
2650
2654
2651
2655
configargparse = callPackage ../development/python-modules/configargparse { };
0 commit comments