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