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