1{ stdenv, buildPythonPackage, fetchPypi 2, geos, glibcLocales, 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 buildInputs = [ geos glibcLocales cython ]; 16 17 checkInputs = [ pytest ]; 18 19 propagatedBuildInputs = [ numpy ]; 20 21 preConfigure = '' 22 export LANG="en_US.UTF-8"; 23 ''; 24 25 patchPhase = let 26 libc = if stdenv.isDarwin then "libc.dylib" else "libc.so.6"; 27 in '' 28 sed -i "s|_lgeos = load_dll('geos_c', fallbacks=.*)|_lgeos = load_dll('geos_c', fallbacks=['${geos}/lib/libgeos_c${stdenv.hostPlatform.extensions.sharedLibrary}'])|" shapely/geos.py 29 sed -i "s|free = load_dll('c').free|free = load_dll('c', fallbacks=['${stdenv.cc.libc}/lib/${libc}']).free|" shapely/geos.py 30 ''; 31 32 # Disable the tests that improperly try to use the built extensions 33 checkPhase = '' 34 py.test -k 'not test_vectorized and not test_fallbacks' tests 35 ''; 36 37 meta = with stdenv.lib; { 38 description = "Geometric objects, predicates, and operations"; 39 maintainers = with maintainers; [ knedlsepp ]; 40 homepage = "https://pypi.python.org/pypi/Shapely/"; 41 }; 42}