1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchPypi,
6 isPyPy,
7 python,
8 oldest-supported-numpy,
9 setuptools,
10 wheel,
11 certifi,
12 numpy,
13 zlib,
14 netcdf,
15 hdf5,
16 curl,
17 libjpeg,
18 cython,
19 cftime,
20}:
21
22buildPythonPackage rec {
23 pname = "netcdf4";
24 version = "1.6.5";
25 format = "pyproject";
26
27 disabled = isPyPy;
28
29 src = fetchPypi {
30 pname = "netCDF4";
31 inherit version;
32 hash = "sha256-gkiB0KrP3lvZgtat7dhXQlnIVVN4HnuD4M6CuJC/oO8=";
33 };
34
35 nativeBuildInputs = [
36 cython
37 oldest-supported-numpy
38 setuptools
39 wheel
40 ];
41
42 propagatedBuildInputs = [
43 certifi
44 cftime
45 numpy
46 zlib
47 netcdf
48 hdf5
49 curl
50 libjpeg
51 ];
52
53 checkPhase = ''
54 pushd test/
55 NO_NET=1 NO_CDL=1 ${python.interpreter} run_all.py
56 '';
57
58 env = {
59 # Variables used to configure the build process
60 USE_NCCONFIG = "0";
61 HDF5_DIR = lib.getDev hdf5;
62 NETCDF4_DIR = netcdf;
63 CURL_DIR = curl.dev;
64 JPEG_DIR = libjpeg.dev;
65 } // lib.optionalAttrs stdenv.cc.isClang { NIX_CFLAGS_COMPILE = "-Wno-error=int-conversion"; };
66
67 pythonImportsCheck = [ "netCDF4" ];
68
69 meta = with lib; {
70 description = "Interface to netCDF library (versions 3 and 4)";
71 homepage = "https://github.com/Unidata/netcdf4-python";
72 changelog = "https://github.com/Unidata/netcdf4-python/raw/v${version}/Changelog";
73 maintainers = [ ];
74 license = licenses.mit;
75 };
76}