1{ stdenv, buildPythonPackage, fetchPypi, substituteAll
2, geos, pytest, cython
3, numpy
4}:
5
6buildPythonPackage rec {
7 pname = "Shapely";
8 version = "1.6.4.post2";
9
10 src = fetchPypi {
11 inherit pname version;
12 sha256 = "c4b87bb61fc3de59fc1f85e71a79b0c709dc68364d9584473697aad4aa13240f";
13 };
14
15 nativeBuildInputs = [
16 geos # for geos-config
17 cython
18 ];
19
20 checkInputs = [ pytest ];
21
22 propagatedBuildInputs = [ numpy ];
23
24 # environment variable used in shapely/_buildcfg.py
25 GEOS_LIBRARY_PATH = "${geos}/lib/libgeos_c${stdenv.hostPlatform.extensions.sharedLibrary}";
26
27 patches = [
28 (substituteAll {
29 src = ./library-paths.patch;
30 libgeos_c = GEOS_LIBRARY_PATH;
31 libc = "${stdenv.cc.libc}/lib/libc${stdenv.hostPlatform.extensions.sharedLibrary}"
32 + stdenv.lib.optionalString (!stdenv.isDarwin) ".6";
33 })
34 ];
35
36 # Disable the tests that improperly try to use the built extensions
37 checkPhase = ''
38 rm -r shapely # prevent import of local shapely
39 py.test tests
40 '';
41
42 meta = with stdenv.lib; {
43 description = "Geometric objects, predicates, and operations";
44 maintainers = with maintainers; [ knedlsepp ];
45 homepage = "https://pypi.python.org/pypi/Shapely/";
46 };
47}