1{ buildPythonPackage
2, fetchFromGitHub
3, fetchpatch
4, pillow
5, scipy
6, numpy
7, pytestCheckHook
8, imread
9, freeimage
10, lib
11, stdenv
12}:
13
14buildPythonPackage rec {
15 pname = "mahotas";
16 version = "1.4.13";
17
18 src = fetchFromGitHub {
19 owner = "luispedro";
20 repo = "mahotas";
21 rev = "v${version}";
22 hash = "sha256-AmctF/9hLgHw6FUm0s61eCdcc12lBa1t0OkXclis//w=";
23 };
24
25 propagatedBuildInputs = [
26 freeimage
27 imread
28 numpy
29 pillow
30 scipy
31 ];
32
33 nativeCheckInputs = [ pytestCheckHook ];
34
35 postPatch = ''
36 substituteInPlace mahotas/io/freeimage.py \
37 --replace "ctypes.util.find_library('freeimage')" 'True' \
38 --replace 'ctypes.CDLL(libname)' 'np.ctypeslib.load_library("libfreeimage", "${freeimage}/lib")'
39 '';
40
41 # tests must be run in the build directory
42 preCheck = ''
43 cd build/lib*
44 '';
45
46 # re-enable as soon as https://github.com/luispedro/mahotas/issues/97 is fixed
47 disabledTests = [
48 "test_colors"
49 "test_ellipse_axes"
50 "test_normalize"
51 "test_haralick3d"
52 ];
53
54 pythonImportsCheck = [
55 "mahotas"
56 "mahotas.freeimage"
57 ];
58
59 disabled = stdenv.isi686; # Failing tests
60
61 meta = with lib; {
62 broken = (stdenv.isLinux && stdenv.isAarch64);
63 description = "Computer vision package based on numpy";
64 homepage = "https://mahotas.readthedocs.io/";
65 maintainers = with maintainers; [ luispedro ];
66 license = licenses.mit;
67 platforms = platforms.unix;
68 };
69}