1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
{
lib,
stdenv,
buildPythonPackage,
fetchFromGitHub,
replaceVars,
openjpeg,
libtiff,
glibc,
# build-system
setuptools,
setuptools-scm,
# dependencies
lxml,
numpy,
pillow,
# tests
addBinToPathHook,
pytestCheckHook,
scikit-image,
}:
buildPythonPackage (finalAttrs: {
pname = "glymur";
version = "0.14.7";
pyproject = true;
src = fetchFromGitHub {
owner = "quintusdias";
repo = "glymur";
tag = "v${finalAttrs.version}";
hash = "sha256-tcc37By5xukcN/C+RxA+B8fmFRlGQDl0aSkkT3zE9ws=";
};
patches = [
(replaceVars ./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}";
})
];
postPatch = lib.optionalString (!stdenv.hostPlatform.isDarwin) ''
substituteInPlace glymur/lib/_tiff.py \
--replace-fail \
'glymur_config("c")' \
'ctypes.CDLL("${lib.getLib glibc}/lib/libc.so.6")'
'';
__propagatedImpureHostDeps = lib.optional stdenv.hostPlatform.isDarwin "/usr/lib/libc.dylib";
build-system = [
setuptools
setuptools-scm
];
dependencies = [
lxml
numpy
pillow
];
nativeCheckInputs = [
addBinToPathHook
pytestCheckHook
scikit-image
];
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"
];
pythonImportsCheck = [ "glymur" ];
meta = {
description = "Tools for accessing JPEG2000 files";
homepage = "https://github.com/quintusdias/glymur";
changelog = "https://github.com/quintusdias/glymur/blob/${finalAttrs.src.tag}/CHANGES.txt";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ tomasajt ];
};
})
|