at master 1.7 kB view raw
1{ 2 lib, 3 buildPythonPackage, 4 certifi, 5 cftime, 6 curl, 7 cython, 8 fetchFromGitHub, 9 hdf5, 10 isPyPy, 11 libjpeg, 12 netcdf, 13 numpy, 14 oldest-supported-numpy, 15 python, 16 pythonOlder, 17 setuptools-scm, 18 stdenv, 19 wheel, 20 zlib, 21}: 22 23let 24 version = "1.7.2"; 25 suffix = lib.optionalString (lib.match ''.*\.post[0-9]+'' version == null) "rel"; 26 tag = "v${version}${suffix}"; 27in 28buildPythonPackage { 29 pname = "netcdf4"; 30 inherit version; 31 pyproject = true; 32 33 disabled = isPyPy || pythonOlder "3.8"; 34 35 src = fetchFromGitHub { 36 owner = "Unidata"; 37 repo = "netcdf4-python"; 38 inherit tag; 39 hash = "sha256-orwCHKOSam+2eRY/yAduFYWREOkJlWIJGIZPZwQZ/RI="; 40 }; 41 42 build-system = [ 43 cython 44 oldest-supported-numpy 45 setuptools-scm 46 wheel 47 ]; 48 49 dependencies = [ 50 certifi 51 cftime 52 numpy 53 ]; 54 55 buildInputs = [ 56 curl 57 hdf5 58 libjpeg 59 netcdf 60 zlib 61 ]; 62 63 checkPhase = '' 64 runHook preCheck 65 66 pushd test/ 67 NO_NET=1 NO_CDL=1 ${python.interpreter} run_all.py 68 69 runHook postCheck 70 ''; 71 72 env = { 73 # Variables used to configure the build process 74 USE_NCCONFIG = "0"; 75 HDF5_DIR = lib.getDev hdf5; 76 NETCDF4_DIR = netcdf; 77 CURL_DIR = curl.dev; 78 JPEG_DIR = libjpeg.dev; 79 } 80 // lib.optionalAttrs stdenv.cc.isClang { NIX_CFLAGS_COMPILE = "-Wno-error=int-conversion"; }; 81 82 pythonImportsCheck = [ "netCDF4" ]; 83 84 meta = with lib; { 85 description = "Interface to netCDF library (versions 3 and 4)"; 86 homepage = "https://github.com/Unidata/netcdf4-python"; 87 changelog = "https://github.com/Unidata/netcdf4-python/raw/${tag}/Changelog"; 88 maintainers = [ ]; 89 license = licenses.mit; 90 }; 91}