2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
stdenv,
|
|
|
|
buildPythonPackage,
|
|
|
|
substituteAll,
|
|
|
|
glibc,
|
|
|
|
libtiff,
|
|
|
|
openjpeg,
|
|
|
|
fetchFromGitHub,
|
|
|
|
lxml,
|
|
|
|
numpy,
|
|
|
|
pytestCheckHook,
|
|
|
|
pythonOlder,
|
|
|
|
scikit-image,
|
|
|
|
setuptools,
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "glymur";
|
2024-07-27 06:49:29 +00:00
|
|
|
version = "0.13.4";
|
2024-05-15 15:35:15 +00:00
|
|
|
pyproject = true;
|
2023-05-24 13:37:59 +00:00
|
|
|
|
|
|
|
disabled = pythonOlder "3.6";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "quintusdias";
|
2024-05-15 15:35:15 +00:00
|
|
|
repo = "glymur";
|
2023-05-24 13:37:59 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
2024-07-27 06:49:29 +00:00
|
|
|
hash = "sha256-RzRZuSNvlUrB+J93a1ob7dDMacZB082JwVHQ9Fce2JA=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
patches = [
|
|
|
|
(substituteAll {
|
|
|
|
src = ./set-lib-paths.patch;
|
|
|
|
openjp2_lib = "${lib.getLib openjpeg}/lib/libopenjp2${stdenv.hostPlatform.extensions.sharedLibrary}";
|
|
|
|
tiff_lib = "${lib.getLib libtiff}/lib/libtiff${stdenv.hostPlatform.extensions.sharedLibrary}";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2024-09-26 11:04:55 +00:00
|
|
|
postPatch = lib.optionalString (!stdenv.hostPlatform.isDarwin) ''
|
2024-05-15 15:35:15 +00:00
|
|
|
substituteInPlace glymur/lib/tiff.py \
|
|
|
|
--replace-fail "glymur_config('c')" "ctypes.CDLL('${lib.getLib glibc}/lib/libc.so.6')"
|
|
|
|
'';
|
|
|
|
|
2024-09-26 11:04:55 +00:00
|
|
|
__propagatedImpureHostDeps = lib.optional stdenv.hostPlatform.isDarwin "/usr/lib/libc.dylib";
|
2024-05-15 15:35:15 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
build-system = [ setuptools ];
|
2023-05-24 13:37:59 +00:00
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
dependencies = [
|
|
|
|
lxml
|
2020-04-24 23:36:52 +00:00
|
|
|
numpy
|
2023-05-24 13:37:59 +00:00
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2023-05-24 13:37:59 +00:00
|
|
|
pytestCheckHook
|
|
|
|
scikit-image
|
2020-04-24 23:36:52 +00:00
|
|
|
];
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
preCheck = ''
|
|
|
|
export PATH="$out/bin:$PATH"
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2021-05-20 23:08:51 +00:00
|
|
|
disabledTestPaths = [
|
|
|
|
# this test involves glymur's different ways of finding the openjpeg path on
|
|
|
|
# fsh systems by reading an .rc file and such, and is obviated by the patch
|
|
|
|
"tests/test_config.py"
|
|
|
|
];
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
pythonImportsCheck = [ "glymur" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
meta = {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "Tools for accessing JPEG2000 files";
|
|
|
|
homepage = "https://github.com/quintusdias/glymur";
|
2024-07-27 06:49:29 +00:00
|
|
|
changelog = "https://github.com/quintusdias/glymur/blob/${src.rev}/CHANGES.txt";
|
2024-05-15 15:35:15 +00:00
|
|
|
license = lib.licenses.mit;
|
|
|
|
maintainers = with lib.maintainers; [ tomasajt ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|