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