nixpkgs/pkgs/development/python-modules/shapely/default.nix

45 lines
1.3 KiB
Nix
Raw Normal View History

{ stdenv, buildPythonPackage, fetchPypi
2017-09-12 19:36:41 +00:00
, geos, glibcLocales, pytest, cython
, numpy
}:
buildPythonPackage rec {
name = "${pname}-${version}";
pname = "Shapely";
2017-12-30 11:27:19 +00:00
version = "1.6.3";
src = fetchPypi {
inherit pname version;
2017-12-30 11:27:19 +00:00
sha256 = "14152f111c7711fc6756fd538ec12fc8cdde7419f869b244922f71f61b2a6c6b";
};
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 19:36:41 +00: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 20:15:17 +00:00
sed -i "s|free = load_dll('c').free|free = load_dll('c', fallbacks=['${stdenv.cc.libc}/lib/${libc}']).free|" shapely/geos.py
'';
# tests/test_voctorized fails because the vectorized extension is not
# available in when running tests
checkPhase = ''
py.test --ignore tests/test_vectorized.py
'';
meta = with stdenv.lib; {
description = "Geometric objects, predicates, and operations";
maintainers = with maintainers; [ knedlsepp ];
homepage = "https://pypi.python.org/pypi/Shapely/";
};
}