2017-09-05 08:38:02 +01:00
|
|
|
{ stdenv, buildPythonPackage, fetchPypi
|
2017-09-12 20:36:41 +01:00
|
|
|
, geos, glibcLocales, pytest, cython
|
2017-09-05 08:38:02 +01:00
|
|
|
, numpy
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "Shapely";
|
2018-07-22 11:20:56 +01:00
|
|
|
version = "1.6.4.post2";
|
2017-09-05 08:38:02 +01:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2018-07-22 11:20:56 +01:00
|
|
|
sha256 = "c4b87bb61fc3de59fc1f85e71a79b0c709dc68364d9584473697aad4aa13240f";
|
2017-09-05 08:38:02 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
buildInputs = [ geos glibcLocales cython ];
|
|
|
|
|
|
|
|
checkInputs = [ pytest ];
|
|
|
|
|
|
|
|
propagatedBuildInputs = [ numpy ];
|
|
|
|
|
|
|
|
preConfigure = ''
|
|
|
|
export LANG="en_US.UTF-8";
|
|
|
|
'';
|
|
|
|
|
|
|
|
patchPhase = let
|
|
|
|
libc = if stdenv.isDarwin then "libc.dylib" else "libc.so.6";
|
|
|
|
in ''
|
2017-09-12 20:36:41 +01:00
|
|
|
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
|
2017-10-09 21:15:17 +01:00
|
|
|
sed -i "s|free = load_dll('c').free|free = load_dll('c', fallbacks=['${stdenv.cc.libc}/lib/${libc}']).free|" shapely/geos.py
|
2017-09-05 08:38:02 +01:00
|
|
|
'';
|
|
|
|
|
2018-03-12 00:29:44 +00:00
|
|
|
# Disable the tests that improperly try to use the built extensions
|
2017-09-05 08:38:02 +01:00
|
|
|
checkPhase = ''
|
2018-03-12 00:29:44 +00:00
|
|
|
py.test -k 'not test_vectorized and not test_fallbacks' tests
|
2017-09-05 08:38:02 +01:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "Geometric objects, predicates, and operations";
|
|
|
|
maintainers = with maintainers; [ knedlsepp ];
|
|
|
|
homepage = "https://pypi.python.org/pypi/Shapely/";
|
|
|
|
};
|
|
|
|
}
|