From 61a8fae2cb887f365a9c70a31452dc07f5997ef3 Mon Sep 17 00:00:00 2001 From: Robert Scott Date: Wed, 8 Dec 2021 23:25:18 +0000 Subject: [PATCH 1/2] python3Packages.mahotas: 1.4.11 -> 1.4.12 --- pkgs/development/python-modules/mahotas/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/development/python-modules/mahotas/default.nix b/pkgs/development/python-modules/mahotas/default.nix index 707ad9f3c8f6..f788486d6624 100644 --- a/pkgs/development/python-modules/mahotas/default.nix +++ b/pkgs/development/python-modules/mahotas/default.nix @@ -2,13 +2,13 @@ buildPythonPackage rec { pname = "mahotas"; - version = "1.4.11"; + version = "1.4.12"; src = fetchFromGitHub { owner = "luispedro"; repo = "mahotas"; rev = "v${version}"; - sha256 = "029gvy1fb855pvxvy8zwj44k4s7qpqi0161bg5wldfiprrysn1kw"; + sha256 = "1n19yha1cqyx7hnlici1wkl7n68dh0vbpsyydfhign2c0w9jvg42"; }; propagatedBuildInputs = [ numpy imread pillow scipy freeimage ]; From c81cf6a24297fcde7783d01cf4b8d87b8920c693 Mon Sep 17 00:00:00 2001 From: Robert Scott Date: Fri, 3 Dec 2021 17:00:22 +0000 Subject: [PATCH 2/2] python3Packages.mahotas: fix freeimage support use a much stronger binding to our specific freeimage that works reliably on linux. previously it didn't and the tests covering freeimage support were just being skipped as they assumed it to be disabled. once the binding works it reveals slight breakage in the tests themselves, fixed with an upstream patch. this breakage was already revealing itsef on darwin as the freeimage binding was "working" there. --- .../python-modules/mahotas/default.nix | 31 +++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/pkgs/development/python-modules/mahotas/default.nix b/pkgs/development/python-modules/mahotas/default.nix index f788486d6624..efc1bec76731 100644 --- a/pkgs/development/python-modules/mahotas/default.nix +++ b/pkgs/development/python-modules/mahotas/default.nix @@ -1,4 +1,15 @@ -{ buildPythonPackage, fetchFromGitHub, pillow, scipy, numpy, pytestCheckHook, imread, freeimage, lib, stdenv }: +{ buildPythonPackage +, fetchFromGitHub +, fetchpatch +, pillow +, scipy +, numpy +, pytestCheckHook +, imread +, freeimage +, lib +, stdenv +}: buildPythonPackage rec { pname = "mahotas"; @@ -11,11 +22,22 @@ buildPythonPackage rec { sha256 = "1n19yha1cqyx7hnlici1wkl7n68dh0vbpsyydfhign2c0w9jvg42"; }; + patches = [ + (fetchpatch { + name = "fix-freeimage-tests.patch"; + url = "https://github.com/luispedro/mahotas/commit/08cc4aa0cbd5dbd4c37580d52b822810c03b2c69.patch"; + sha256 = "0389sz7fyl8h42phw8sn4pxl4wc3brcrj9d05yga21gzil9bfi23"; + excludes = [ "ChangeLog" ]; + }) + ]; + propagatedBuildInputs = [ numpy imread pillow scipy freeimage ]; checkInputs = [ pytestCheckHook ]; postPatch = '' - substituteInPlace mahotas/io/freeimage.py --replace "/opt/local/lib" "${freeimage}/lib" + substituteInPlace mahotas/io/freeimage.py \ + --replace "ctypes.util.find_library('freeimage')" 'True' \ + --replace 'ctypes.CDLL(libname)' 'np.ctypeslib.load_library("libfreeimage", "${freeimage}/lib")' ''; # tests must be run in the build directory @@ -31,6 +53,11 @@ buildPythonPackage rec { "test_haralick3d" ]; + pythonImportsCheck = [ + "mahotas" + "mahotas.freeimage" + ]; + disabled = stdenv.isi686; # Failing tests meta = with lib; {