2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
buildPythonPackage,
|
|
|
|
pythonOlder,
|
|
|
|
fetchFromGitHub,
|
|
|
|
isPyPy,
|
|
|
|
substituteAll,
|
|
|
|
|
|
|
|
# build-system
|
|
|
|
setuptools,
|
|
|
|
|
|
|
|
# native dependencies
|
|
|
|
libGL,
|
|
|
|
|
|
|
|
# dependencies
|
|
|
|
numpy,
|
|
|
|
pillow,
|
|
|
|
|
|
|
|
# optional-dependencies
|
|
|
|
astropy,
|
|
|
|
av,
|
|
|
|
imageio-ffmpeg,
|
|
|
|
pillow-heif,
|
|
|
|
psutil,
|
|
|
|
tifffile,
|
|
|
|
|
|
|
|
# tests
|
|
|
|
pytestCheckHook,
|
|
|
|
fsspec,
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "imageio";
|
2024-05-15 15:35:15 +00:00
|
|
|
version = "2.34.1";
|
2023-11-16 04:20:00 +00:00
|
|
|
pyproject = true;
|
2023-05-24 13:37:59 +00:00
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
disabled = pythonOlder "3.8";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "imageio";
|
|
|
|
repo = "imageio";
|
|
|
|
rev = "refs/tags/v${version}";
|
2024-05-15 15:35:15 +00:00
|
|
|
hash = "sha256-/VZUifiz8iImq+JLvckFDr7YMIqu0Xro2t3GFj0obg0=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
patches = lib.optionals (!stdenv.isDarwin) [
|
2022-04-15 01:41:22 +00:00
|
|
|
(substituteAll {
|
|
|
|
src = ./libgl-path.patch;
|
|
|
|
libgl = "${libGL.out}/lib/libGL${stdenv.hostPlatform.extensions.sharedLibrary}";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
build-system = [ setuptools ];
|
2023-11-16 04:20:00 +00:00
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
dependencies = [
|
2021-05-20 23:08:51 +00:00
|
|
|
numpy
|
|
|
|
pillow
|
|
|
|
];
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
passthru.optional-dependencies = {
|
2024-06-05 15:53:02 +00:00
|
|
|
bsdf = [ ];
|
|
|
|
dicom = [ ];
|
|
|
|
feisem = [ ];
|
2023-11-16 04:20:00 +00:00
|
|
|
ffmpeg = [
|
|
|
|
imageio-ffmpeg
|
|
|
|
psutil
|
|
|
|
];
|
2024-06-05 15:53:02 +00:00
|
|
|
fits = lib.optionals (!isPyPy) [ astropy ];
|
|
|
|
freeimage = [ ];
|
|
|
|
lytro = [ ];
|
|
|
|
numpy = [ ];
|
|
|
|
pillow = [ ];
|
|
|
|
simpleitk = [ ];
|
|
|
|
spe = [ ];
|
|
|
|
swf = [ ];
|
|
|
|
tifffile = [ tifffile ];
|
|
|
|
pyav = [ av ];
|
|
|
|
heif = [ pillow-heif ];
|
2023-11-16 04:20:00 +00:00
|
|
|
};
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
nativeCheckInputs =
|
|
|
|
[
|
|
|
|
fsspec
|
|
|
|
psutil
|
|
|
|
pytestCheckHook
|
|
|
|
]
|
|
|
|
++ fsspec.optional-dependencies.github
|
|
|
|
++ lib.flatten (builtins.attrValues passthru.optional-dependencies);
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
pytestFlagsArray = [ "-m 'not needs_internet'" ];
|
2022-04-15 01:41:22 +00:00
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
preCheck = ''
|
2020-04-24 23:36:52 +00:00
|
|
|
export IMAGEIO_USERDIR="$TMP"
|
2022-04-15 01:41:22 +00:00
|
|
|
export HOME=$TMPDIR
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-12-26 17:43:05 +00:00
|
|
|
disabledTestPaths = [
|
2022-04-15 01:41:22 +00:00
|
|
|
# tries to fetch fixtures over the network
|
|
|
|
"tests/test_freeimage.py"
|
2021-12-26 17:43:05 +00:00
|
|
|
"tests/test_pillow.py"
|
2022-04-15 01:41:22 +00:00
|
|
|
"tests/test_spe.py"
|
|
|
|
"tests/test_swf.py"
|
2021-12-26 17:43:05 +00:00
|
|
|
];
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
disabledTests = lib.optionals stdenv.isDarwin [
|
|
|
|
# Segmentation fault
|
|
|
|
"test_bayer_write"
|
|
|
|
# RuntimeError: No valid H.264 encoder was found with the ffmpeg installation
|
|
|
|
"test_writer_file_properly_closed"
|
|
|
|
"test_writer_pixelformat_size_verbose"
|
|
|
|
"test_writer_ffmpeg_params"
|
|
|
|
"test_reverse_read"
|
|
|
|
];
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Library for reading and writing a wide range of image, video, scientific, and volumetric data formats";
|
2023-05-24 13:37:59 +00:00
|
|
|
homepage = "https://imageio.readthedocs.io";
|
|
|
|
changelog = "https://github.com/imageio/imageio/blob/v${version}/CHANGELOG.md";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.bsd2;
|
2022-09-30 11:47:45 +00:00
|
|
|
maintainers = with maintainers; [ Luflosi ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|