2021-03-09 03:18:52 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, buildPythonPackage
|
|
|
|
, fetchPypi
|
|
|
|
, substituteAll
|
|
|
|
, pythonOlder
|
|
|
|
, geos
|
|
|
|
, pytestCheckHook
|
|
|
|
, cython
|
2020-04-24 23:36:52 +00:00
|
|
|
, numpy
|
2021-03-09 03:18:52 +00:00
|
|
|
, fetchpatch
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "Shapely";
|
2020-10-27 00:29:36 +00:00
|
|
|
version = "1.7.1";
|
2021-03-09 03:18:52 +00:00
|
|
|
disabled = pythonOlder "3.5";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchPypi {
|
|
|
|
inherit pname version;
|
2020-10-27 00:29:36 +00:00
|
|
|
sha256 = "0adiz4jwmwxk7k1awqifb1a9bj5x4nx4gglb5dz9liam21674h8n";
|
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
|
|
|
# Fix with geos 3.9. This patch will be part of the next release after 1.7.1
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://github.com/Toblerity/Shapely/commit/77879a954d24d1596f986d16ba3eff5e13861164.patch";
|
|
|
|
sha256 = "1w7ngjqbpf9vnvrfg4nyv34kckim9a60gvx20h6skc79xwihd4m5";
|
|
|
|
excludes = [
|
|
|
|
"tests/test_create_inconsistent_dimensionality.py"
|
|
|
|
"appveyor.yml"
|
|
|
|
".travis.yml"
|
|
|
|
];
|
|
|
|
})
|
|
|
|
# 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
|
|
|
})
|
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
|
|
|
};
|
|
|
|
}
|