1{ stdenv
2, buildPythonPackage
3, fetchFromGitHub
4, numpy
5, setuptools
6, python
7, scikitimage
8, openjpeg
9, procps
10, contextlib2
11, mock
12, importlib-resources
13, isPy27
14}:
15
16buildPythonPackage rec {
17 pname = "glymur";
18 version = "0.8.18";
19
20 src = fetchFromGitHub {
21 owner = "quintusdias";
22 repo = pname;
23 rev = "v${version}";
24 sha256 = "1zbghzw1q4fljb019lsrhka9xrnn4425qnxrjbmbv7dssgkkywd7";
25 };
26
27 propagatedBuildInputs = [
28 numpy
29 ] ++ stdenv.lib.optional isPy27 [ contextlib2 mock importlib-resources ];
30
31 checkInputs = [
32 scikitimage
33 procps
34 ];
35
36 postConfigure = ''
37 substituteInPlace glymur/config.py \
38 --replace "path = read_config_file(libname)" "path = '${openjpeg}/lib' + libname + ${if stdenv.isDarwin then "'.dylib'" else "'.so'"}"
39 '';
40
41 checkPhase = ''
42 ${python.interpreter} -m unittest discover
43 '';
44
45 meta = with stdenv.lib; {
46 description = "Tools for accessing JPEG2000 files";
47 homepage = "https://github.com/quintusdias/glymur";
48 license = licenses.mit;
49 maintainers = [ maintainers.costrouc ];
50 };
51}