about summary refs log tree commit diff
path: root/pkgs/development
diff options
context:
space:
mode:
authorIvan Mincik <ivan.mincik@gmail.com>2024-04-11 07:36:18 +0000
committerGitHub <noreply@github.com>2024-04-11 07:36:18 +0000
commit646f0dcd0133210c20805729e53168a15c7db211 (patch)
tree70815022f0c7a09cb59e8c68d500727d9722f2c3 /pkgs/development
parent7e29fe4391227feda8a30b84f0fbb02c4ef54915 (diff)
parent67b8cbae2b52c631a330453fa74cd987f708a889 (diff)
Merge pull request #302154 from imincik/rasterio-dont-propagate-setuptools
python3Packages.rasterio: don't propagate setuptools
Diffstat (limited to 'pkgs/development')
-rw-r--r--pkgs/development/python-modules/rasterio/default.nix22
1 files changed, 21 insertions, 1 deletions
diff --git a/pkgs/development/python-modules/rasterio/default.nix b/pkgs/development/python-modules/rasterio/default.nix
index 4f8113eeb18f4..07dfa2c94aae5 100644
--- a/pkgs/development/python-modules/rasterio/default.nix
+++ b/pkgs/development/python-modules/rasterio/default.nix
@@ -5,6 +5,7 @@
 , pytestCheckHook
 , pythonOlder
 , stdenv
+, testers
 
 , affine
 , attrs
@@ -26,6 +27,8 @@
 , shapely
 , snuggs
 , wheel
+
+, rasterio  # required to run version test
 }:
 
 buildPythonPackage rec {
@@ -54,6 +57,12 @@ buildPythonPackage rec {
     })
   ];
 
+  postPatch = ''
+    # remove useless import statement requiring distutils to be present at the runtime
+    substituteInPlace rasterio/rio/calc.py \
+      --replace-fail "from distutils.version import LooseVersion" ""
+    '';
+
   nativeBuildInputs = [
     cython_3
     gdal
@@ -71,7 +80,6 @@ buildPythonPackage rec {
     click-plugins
     cligj
     numpy
-    setuptools
     snuggs
   ];
 
@@ -96,6 +104,12 @@ buildPythonPackage rec {
     shapely
   ];
 
+  # rio has runtime dependency on setuptools
+  setuptoolsPythonPath = [ setuptools ];
+  postInstall = ''
+    wrapPythonProgramsIn "$out/bin" "$out $setuptoolsPythonPath"
+  '';
+
   doCheck = true;
 
   preCheck = ''
@@ -120,6 +134,12 @@ buildPythonPackage rec {
     "rasterio"
   ];
 
+  passthru.tests.version = testers.testVersion {
+    package = rasterio;
+    version = version;
+    command = "${rasterio}/bin/rio --version";
+  };
+
   meta = with lib; {
     description = "Python package to read and write geospatial raster data";
     mainProgram = "rio";