From 5e7b94d64bfa8ac51a245511449836f252c58278 Mon Sep 17 00:00:00 2001 From: Ivan Mincik Date: Sat, 6 Apr 2024 20:01:33 +0200 Subject: [PATCH 1/2] python3Packages.rasterio: don't propagate setuptools --- pkgs/development/python-modules/rasterio/default.nix | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pkgs/development/python-modules/rasterio/default.nix b/pkgs/development/python-modules/rasterio/default.nix index 4f8113eeb18f..65274b6849af 100644 --- a/pkgs/development/python-modules/rasterio/default.nix +++ b/pkgs/development/python-modules/rasterio/default.nix @@ -54,6 +54,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 +77,6 @@ buildPythonPackage rec { click-plugins cligj numpy - setuptools snuggs ]; @@ -96,6 +101,11 @@ buildPythonPackage rec { shapely ]; + # rio has runtime dependency on setuptools + setuptoolsPythonPath = [ setuptools ]; + postInstall = '' + wrapPythonProgramsIn "$out/bin" "$out $setuptoolsPythonPath" + ''; doCheck = true; preCheck = '' From 67b8cbae2b52c631a330453fa74cd987f708a889 Mon Sep 17 00:00:00 2001 From: Ivan Mincik Date: Mon, 8 Apr 2024 12:28:46 +0200 Subject: [PATCH 2/2] python3Packages.rasterio: add rio version test --- pkgs/development/python-modules/rasterio/default.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkgs/development/python-modules/rasterio/default.nix b/pkgs/development/python-modules/rasterio/default.nix index 65274b6849af..07dfa2c94aae 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 { @@ -106,6 +109,7 @@ buildPythonPackage rec { postInstall = '' wrapPythonProgramsIn "$out/bin" "$out $setuptoolsPythonPath" ''; + doCheck = true; preCheck = '' @@ -130,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";