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