1{ lib,
2 stdenv,
3 buildPythonPackage,
4 fetchPypi,
5 libspatialindex,
6 numpy,
7 pytestCheckHook
8}:
9
10buildPythonPackage rec {
11 pname = "Rtree";
12 version = "0.9.7";
13
14 src = fetchPypi {
15 inherit pname version;
16 sha256 = "be8772ca34699a9ad3fb4cfe2cfb6629854e453c10b3328039301bbfc128ca3e";
17 };
18
19 buildInputs = [ libspatialindex ];
20
21 patchPhase = ''
22 substituteInPlace rtree/finder.py --replace \
23 "find_library('spatialindex_c')" "'${libspatialindex}/lib/libspatialindex_c${stdenv.hostPlatform.extensions.sharedLibrary}'"
24 '';
25
26 checkInputs = [
27 numpy
28 pytestCheckHook
29 ];
30 pythonImportsCheck = [ "rtree" ];
31
32 meta = with lib; {
33 description = "R-Tree spatial index for Python GIS";
34 homepage = "https://toblerity.org/rtree/";
35 license = licenses.mit;
36 maintainers = with maintainers; [ bgamari ];
37 };
38}