2021-12-19 01:06:50 +00:00
|
|
|
{ buildPythonPackage
|
|
|
|
, fetchFromGitHub
|
|
|
|
, fetchpatch
|
|
|
|
, pillow
|
|
|
|
, scipy
|
|
|
|
, numpy
|
|
|
|
, pytestCheckHook
|
|
|
|
, imread
|
|
|
|
, freeimage
|
|
|
|
, lib
|
|
|
|
, stdenv
|
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "mahotas";
|
2022-08-21 13:32:41 +00:00
|
|
|
version = "1.4.13";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "luispedro";
|
|
|
|
repo = "mahotas";
|
|
|
|
rev = "v${version}";
|
2022-08-21 13:32:41 +00:00
|
|
|
sha256 = "sha256-AmctF/9hLgHw6FUm0s61eCdcc12lBa1t0OkXclis//w=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-08-21 13:32:41 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
freeimage
|
|
|
|
imread
|
|
|
|
numpy
|
|
|
|
pillow
|
|
|
|
scipy
|
2021-12-19 01:06:50 +00:00
|
|
|
];
|
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
checkInputs = [ pytestCheckHook ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
postPatch = ''
|
2021-12-19 01:06:50 +00:00
|
|
|
substituteInPlace mahotas/io/freeimage.py \
|
|
|
|
--replace "ctypes.util.find_library('freeimage')" 'True' \
|
|
|
|
--replace 'ctypes.CDLL(libname)' 'np.ctypeslib.load_library("libfreeimage", "${freeimage}/lib")'
|
2021-06-28 23:13:55 +00:00
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
# tests must be run in the build directory
|
|
|
|
preCheck = ''
|
|
|
|
cd build/lib*
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
# re-enable as soon as https://github.com/luispedro/mahotas/issues/97 is fixed
|
|
|
|
disabledTests = [
|
|
|
|
"test_colors"
|
|
|
|
"test_ellipse_axes"
|
|
|
|
"test_normalize"
|
|
|
|
"test_haralick3d"
|
|
|
|
];
|
|
|
|
|
2021-12-19 01:06:50 +00:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"mahotas"
|
|
|
|
"mahotas.freeimage"
|
|
|
|
];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
disabled = stdenv.isi686; # Failing tests
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2022-06-16 17:23:12 +00:00
|
|
|
broken = (stdenv.isLinux && stdenv.isAarch64);
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Computer vision package based on numpy";
|
|
|
|
homepage = "https://mahotas.readthedocs.io/";
|
|
|
|
maintainers = with maintainers; [ luispedro ];
|
|
|
|
license = licenses.mit;
|
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
}
|