1{ lib, stdenv
2, buildPythonPackage
3, fetchFromGitHub
4, numpy
5, scikitimage
6, openjpeg
7, procps
8, pytestCheckHook
9, contextlib2
10, mock
11, importlib-resources
12, isPy27
13, lxml
14}:
15
16buildPythonPackage rec {
17 pname = "glymur";
18 version = "0.9.3";
19
20 src = fetchFromGitHub {
21 owner = "quintusdias";
22 repo = pname;
23 rev = "v${version}";
24 sha256 = "1xlpax56qg5qqh0s19xidgvv2483sc684zj7rh6zw1m1z9m37drr";
25 };
26
27 propagatedBuildInputs = [
28 numpy
29 ] ++ lib.optionals isPy27 [ contextlib2 mock importlib-resources ];
30
31 checkInputs = [
32 scikitimage
33 procps
34 pytestCheckHook
35 lxml
36 ];
37
38 postConfigure = ''
39 substituteInPlace glymur/config.py \
40 --replace "path = read_config_file(libname)" "path = '${openjpeg}/lib/lib' + libname + ${if stdenv.isDarwin then "'.dylib'" else "'.so'"}"
41 '';
42
43 disabledTestPaths = [
44 # this test involves glymur's different ways of finding the openjpeg path on
45 # fsh systems by reading an .rc file and such, and is obviated by the patch
46 # in postConfigure
47 "tests/test_config.py"
48 ];
49
50
51 meta = with lib; {
52 description = "Tools for accessing JPEG2000 files";
53 homepage = "https://github.com/quintusdias/glymur";
54 license = licenses.mit;
55 maintainers = [ maintainers.costrouc ];
56 };
57}