summary refs log tree commit diff
path: root/pkgs/development/python-modules/cartopy/default.nix
blob: c01f27608fdfa20d545bc15479e1d49304685845 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
{ buildPythonPackage, lib, fetchPypi
, pytest_4, filelock, mock, pep8
, cython, isPy27
, six, pyshp, shapely, geos, numpy
, gdal, pillow, matplotlib, pyepsg, pykdtree, scipy, owslib, fiona
, xvfb_run
, proj_5 # see https://github.com/SciTools/cartopy/pull/1252 for status on proj 6 support
}:

buildPythonPackage rec {
  pname = "cartopy";
  version = "0.17.0";

  src = fetchPypi {
    inherit version;
    pname = "Cartopy";
    sha256 = "0q9ckfi37cxj7jwnqnzij62vwcf4krccx576vv5lhvpgvplxjjs2";
  };

  checkInputs = [ filelock mock pytest_4 pep8 ];

  # several tests require network connectivity: we disable them.
  # also py2.7's tk is over-eager in trying to open an x display,
  # so give it xvfb
  checkPhase = let
    maybeXvfbRun = lib.optionalString isPy27 "${xvfb_run}/bin/xvfb-run";
  in ''
    export HOME=$(mktemp -d)
    ${maybeXvfbRun} pytest --pyargs cartopy \
      -m "not network and not natural_earth" \
      -k "not test_nightshade_image and not background_img"
  '';

  nativeBuildInputs = [
    cython
    geos # for geos-config
    proj_5
  ];

  buildInputs = [
    geos proj_5
  ];

  propagatedBuildInputs = [
    # required
    six pyshp shapely numpy

    # optional
    gdal pillow matplotlib pyepsg pykdtree scipy fiona owslib
  ];

  meta = with lib; {
    description = "Process geospatial data to create maps and perform analyses";
    license = licenses.lgpl3;
    homepage = "https://scitools.org.uk/cartopy/docs/latest/";
    maintainers = with maintainers; [ mredaelli ];
  };

}