1{ stdenv, lib, buildPythonPackage, fetchPypi, isPy3k, pythonOlder
2, attrs, click, cligj, click-plugins, six, munch, enum34
3, pytestCheckHook, boto3, mock, giflib, pytz
4, gdal, certifi
5, fetchpatch
6}:
7
8buildPythonPackage rec {
9 pname = "fiona";
10 version = "1.8.22";
11
12 src = fetchPypi {
13 pname = "Fiona";
14 inherit version;
15 sha256 = "sha256-qCqZzps+eCV0AVfEXJ+yJZ1OkvCohqqsJfDbQP/h7qM=";
16 };
17
18 patches = [
19 # https://github.com/Toblerity/Fiona/pull/1122
20 (fetchpatch {
21 url = "https://github.com/Toblerity/Fiona/commit/fa632130dcd9dfbb982ecaa4911b3fab3459168f.patch";
22 hash = "sha256-IuNHr3yBqS1jY9Swvcq8XPv6BpVlInDx0FVuzEMaYTY=";
23 })
24 ];
25
26 CXXFLAGS = lib.optionalString stdenv.cc.isClang "-std=c++11";
27
28 nativeBuildInputs = [
29 gdal # for gdal-config
30 ];
31
32 buildInputs = [
33 gdal
34 ] ++ lib.optionals stdenv.cc.isClang [ giflib ];
35
36 propagatedBuildInputs = [
37 attrs
38 certifi
39 click
40 cligj
41 click-plugins
42 six
43 munch
44 pytz
45 ] ++ lib.optional (!isPy3k) enum34;
46
47 checkInputs = [
48 pytestCheckHook
49 boto3
50 ] ++ lib.optional (pythonOlder "3.4") mock;
51
52 preCheck = ''
53 rm -r fiona # prevent importing local fiona
54 # disable gdal deprecation warnings
55 export GDAL_ENABLE_DEPRECATED_DRIVER_GTM=YES
56 '';
57
58 disabledTests = [
59 # Some tests access network, others test packaging
60 "http" "https" "wheel"
61 ];
62
63 meta = with lib; {
64 description = "OGR's neat, nimble, no-nonsense API for Python";
65 homepage = "https://fiona.readthedocs.io/";
66 license = licenses.bsd3;
67 maintainers = with maintainers; [ knedlsepp ];
68 };
69}