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

43 lines
1.2 KiB
Nix
Raw Normal View History

{ stdenv, buildPythonPackage, fetchPypi
2017-09-12 19:36:41 +00:00
, geos, glibcLocales, pytest, cython
, numpy
}:
buildPythonPackage rec {
pname = "Shapely";
2018-02-03 09:54:35 +00:00
version = "1.6.4.post1";
src = fetchPypi {
inherit pname version;
2018-02-03 09:54:35 +00:00
sha256 = "30df7572d311514802df8dc0e229d1660bc4cbdcf027a8281e79c5fc2fcf02f2";
};
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
'';
# Disable the tests that improperly try to use the built extensions
checkPhase = ''
py.test -k 'not test_vectorized and not test_fallbacks' tests
'';
meta = with stdenv.lib; {
description = "Geometric objects, predicates, and operations";
maintainers = with maintainers; [ knedlsepp ];
homepage = "https://pypi.python.org/pypi/Shapely/";
};
}