2021-03-09 03:18:52 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchPypi
|
2022-08-12 12:06:08 +00:00
|
|
|
, fetchpatch
|
2021-03-09 03:18:52 +00:00
|
|
|
, substituteAll
|
|
|
|
, pythonOlder
|
|
|
|
, geos
|
|
|
|
, pytestCheckHook
|
|
|
|
, cython
|
2020-04-24 23:36:52 +00:00
|
|
|
, numpy
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "Shapely";
|
2022-05-18 14:49:53 +00:00
|
|
|
version = "1.8.2";
|
2021-10-28 06:52:43 +00:00
|
|
|
disabled = pythonOlder "3.6";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2022-05-18 14:49:53 +00:00
|
|
|
sha256 = "sha256-Vyr51QBv1eMhPjfuVIkSsDQfsmck1tyKTjlQwQGX67Y=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
geos # for geos-config
|
|
|
|
cython
|
|
|
|
];
|
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
numpy
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
checkInputs = [
|
|
|
|
pytestCheckHook
|
|
|
|
];
|
2021-02-24 18:30:23 +00:00
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
# Environment variable used in shapely/_buildcfg.py
|
2020-04-24 23:36:52 +00:00
|
|
|
GEOS_LIBRARY_PATH = "${geos}/lib/libgeos_c${stdenv.hostPlatform.extensions.sharedLibrary}";
|
|
|
|
|
|
|
|
patches = [
|
2021-03-09 03:18:52 +00:00
|
|
|
# Patch to search form GOES .so/.dylib files in a Nix-aware way
|
2020-04-24 23:36:52 +00:00
|
|
|
(substituteAll {
|
|
|
|
src = ./library-paths.patch;
|
|
|
|
libgeos_c = GEOS_LIBRARY_PATH;
|
2021-02-05 17:12:51 +00:00
|
|
|
libc = lib.optionalString (!stdenv.isDarwin) "${stdenv.cc.libc}/lib/libc${stdenv.hostPlatform.extensions.sharedLibrary}.6";
|
2020-04-24 23:36:52 +00:00
|
|
|
})
|
2022-08-12 12:06:08 +00:00
|
|
|
(fetchpatch {
|
|
|
|
name = "fix-tests-geos-3.11.patch";
|
|
|
|
url = "https://github.com/shapely/shapely/commit/21c8e8a7909e7fb3cce6daa5c5b8284ac927fcb0.patch";
|
|
|
|
includes = [ "tests/test_parallel_offset.py" ];
|
|
|
|
sha256 = "sha256-85c8NlmAzzfCgepe/411ug5Sq+665dFMb3ySaUt9Kew=";
|
|
|
|
})
|
2021-02-22 21:28:39 +00:00
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-02-24 18:30:23 +00:00
|
|
|
preCheck = ''
|
2020-04-24 23:36:52 +00:00
|
|
|
rm -r shapely # prevent import of local shapely
|
|
|
|
'';
|
|
|
|
|
2021-02-24 18:30:23 +00:00
|
|
|
disabledTests = [
|
|
|
|
"test_collection"
|
|
|
|
];
|
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
pythonImportsCheck = [ "shapely" ];
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Geometric objects, predicates, and operations";
|
|
|
|
homepage = "https://pypi.python.org/pypi/Shapely/";
|
2021-03-09 03:18:52 +00:00
|
|
|
license = with licenses; [ bsd3 ];
|
|
|
|
maintainers = with maintainers; [ knedlsepp ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|