nixpkgs/pkgs/development/python-modules/mahotas/default.nix
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00

63 lines
1.4 KiB
Nix

{
buildPythonPackage,
fetchFromGitHub,
pillow,
scipy,
numpy,
pytestCheckHook,
imread,
lib,
stdenv,
}:
buildPythonPackage rec {
pname = "mahotas";
version = "1.4.14";
format = "setuptools";
src = fetchFromGitHub {
owner = "luispedro";
repo = "mahotas";
rev = "refs/tags/v${version}";
hash = "sha256-9tjk3rhcfAYROZKwmwHzHAN7Ui0EgmxPErQyF//K0r8=";
};
propagatedBuildInputs = [
imread
numpy
pillow
scipy
];
nativeCheckInputs = [ pytestCheckHook ];
# mahotas/_morph.cpp:864:10: error: no member named 'random_shuffle' in namespace 'std'
env = lib.optionalAttrs stdenv.cc.isClang { NIX_CFLAGS_COMPILE = "-std=c++14"; };
# tests must be run in the build directory
preCheck = ''
cd build/lib*
'';
# re-enable as soon as https://github.com/luispedro/mahotas/issues/97 is fixed
disabledTests = [
"test_colors"
"test_ellipse_axes"
"test_normalize"
"test_haralick3d"
];
pythonImportsCheck = [ "mahotas" ];
disabled = stdenv.hostPlatform.isi686; # Failing tests
meta = with lib; {
broken = (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64);
description = "Computer vision package based on numpy";
homepage = "https://mahotas.readthedocs.io/";
maintainers = with maintainers; [ luispedro ];
license = licenses.mit;
platforms = platforms.unix;
};
}