Merge pull request #302154 from imincik/rasterio-dont-propagate-setuptools

python3Packages.rasterio: don't propagate setuptools
This commit is contained in:
Ivan Mincik 2024-04-11 07:36:18 +00:00 committed by GitHub
commit 646f0dcd01
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -5,6 +5,7 @@
, pytestCheckHook , pytestCheckHook
, pythonOlder , pythonOlder
, stdenv , stdenv
, testers
, affine , affine
, attrs , attrs
@ -26,6 +27,8 @@
, shapely , shapely
, snuggs , snuggs
, wheel , wheel
, rasterio # required to run version test
}: }:
buildPythonPackage rec { 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 = [ nativeBuildInputs = [
cython_3 cython_3
gdal gdal
@ -71,7 +80,6 @@ buildPythonPackage rec {
click-plugins click-plugins
cligj cligj
numpy numpy
setuptools
snuggs snuggs
]; ];
@ -96,6 +104,12 @@ buildPythonPackage rec {
shapely shapely
]; ];
# rio has runtime dependency on setuptools
setuptoolsPythonPath = [ setuptools ];
postInstall = ''
wrapPythonProgramsIn "$out/bin" "$out $setuptoolsPythonPath"
'';
doCheck = true; doCheck = true;
preCheck = '' preCheck = ''
@ -120,6 +134,12 @@ buildPythonPackage rec {
"rasterio" "rasterio"
]; ];
passthru.tests.version = testers.testVersion {
package = rasterio;
version = version;
command = "${rasterio}/bin/rio --version";
};
meta = with lib; { meta = with lib; {
description = "Python package to read and write geospatial raster data"; description = "Python package to read and write geospatial raster data";
mainProgram = "rio"; mainProgram = "rio";