about summary refs log tree commit diff
path: root/nixpkgs/pkgs/by-name/ki/kikit/shapely/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/by-name/ki/kikit/shapely/default.nix')
-rw-r--r--nixpkgs/pkgs/by-name/ki/kikit/shapely/default.nix71
1 files changed, 71 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/by-name/ki/kikit/shapely/default.nix b/nixpkgs/pkgs/by-name/ki/kikit/shapely/default.nix
new file mode 100644
index 000000000000..7f136a1338ad
--- /dev/null
+++ b/nixpkgs/pkgs/by-name/ki/kikit/shapely/default.nix
@@ -0,0 +1,71 @@
+{ lib
+, stdenv
+, buildPythonPackage
+, fetchPypi
+, substituteAll
+, pythonOlder
+, geos
+, pytestCheckHook
+, cython
+, numpy
+}:
+
+buildPythonPackage rec {
+  pname = "Shapely";
+  version = "1.8.4";
+  disabled = pythonOlder "3.6";
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "sha256-oZXlHKr6IYKR8suqP+9p/TNTyT7EtlsqRyLEz0DDGYw=";
+  };
+
+  nativeBuildInputs = [
+    geos # for geos-config
+    cython
+  ];
+
+  propagatedBuildInputs = [
+    numpy
+  ];
+
+  checkInputs = [
+    pytestCheckHook
+  ];
+
+  # Environment variable used in shapely/_buildcfg.py
+  GEOS_LIBRARY_PATH = "${geos}/lib/libgeos_c${stdenv.hostPlatform.extensions.sharedLibrary}";
+
+  patches = [
+    # Patch to search form GOES .so/.dylib files in a Nix-aware way
+    (substituteAll {
+      src = ./library-paths.patch;
+      libgeos_c = GEOS_LIBRARY_PATH;
+      libc = lib.optionalString (!stdenv.isDarwin) "${stdenv.cc.libc}/lib/libc${stdenv.hostPlatform.extensions.sharedLibrary}.6";
+    })
+  ];
+
+  preCheck = ''
+    rm -r shapely # prevent import of local shapely
+  '';
+
+  disabledTests = lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
+    # FIXME(lf-): these logging tests are broken, which is definitely our
+    # fault. I've tried figuring out the cause and failed.
+    #
+    # It is apparently some sandbox or no-sandbox related thing on macOS only
+    # though.
+    "test_error_handler_exception"
+    "test_error_handler"
+    "test_info_handler"
+  ];
+
+  pythonImportsCheck = [ "shapely" ];
+
+  meta = with lib; {
+    description = "Geometric objects, predicates, and operations";
+    homepage = "https://pypi.python.org/pypi/Shapely/";
+    license = with licenses; [ bsd3 ];
+    maintainers = with maintainers; [ knedlsepp ];
+  };
+}