mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-10-02 21:10:08 +00:00
Merge pull request #150161 from risicle/ris-mahotas-freeimage-r21.11
[21.11] python3Packages.mahotas: fix freeimage support
This commit is contained in:
@@ -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 = "029gvy1fb855pvxvy8zwj44k4s7qpqi0161bg5wldfiprrysn1kw";
|
||||
};
|
||||
|
||||
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
|
||||
@@ -29,6 +51,12 @@ buildPythonPackage rec {
|
||||
"test_ellipse_axes"
|
||||
"test_normalize"
|
||||
"test_haralick3d"
|
||||
"test_uint16"
|
||||
];
|
||||
|
||||
pythonImportsCheck = [
|
||||
"mahotas"
|
||||
"mahotas.freeimage"
|
||||
];
|
||||
|
||||
disabled = stdenv.isi686; # Failing tests
|
||||
|
||||
Reference in New Issue
Block a user