1{ stdenv, buildPythonPackage, fetchPypi, libspatialindex, numpy }:
2
3buildPythonPackage rec {
4 pname = "Rtree";
5 version = "0.9.4";
6
7 src = fetchPypi {
8 inherit pname version;
9 sha256 = "0i1zlyz6vczy3cgg7fan5hq9zzjm7s7zdzfh83ma8g9vq3i2gqya";
10 };
11
12 propagatedBuildInputs = [ libspatialindex ];
13
14 patchPhase = ''
15 substituteInPlace rtree/core.py --replace \
16 "find_library('spatialindex_c')" "'${libspatialindex}/lib/libspatialindex_c${stdenv.hostPlatform.extensions.sharedLibrary}'"
17 '';
18
19 # Tests appear to be broken due to mysterious memory unsafe issues. See #36760
20 doCheck = false;
21 checkInputs = [ numpy ];
22
23 meta = with stdenv.lib; {
24 description = "R-Tree spatial index for Python GIS";
25 homepage = "https://toblerity.org/rtree/";
26 license = licenses.lgpl21;
27 maintainers = with maintainers; [ bgamari ];
28 };
29}