at master 2.2 kB view raw
1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 fetchFromGitHub, 6 fetchpatch, 7 glibc, 8 libtiff, 9 lxml, 10 numpy, 11 openjpeg, 12 pytestCheckHook, 13 pythonOlder, 14 scikit-image, 15 setuptools, 16 replaceVars, 17}: 18 19buildPythonPackage rec { 20 pname = "glymur"; 21 version = "0.13.6"; 22 pyproject = true; 23 24 disabled = pythonOlder "3.10"; 25 26 src = fetchFromGitHub { 27 owner = "quintusdias"; 28 repo = "glymur"; 29 tag = "v${version}"; 30 hash = "sha256-tIvDhlFPpDxC3CgBDT0RN9MM8ycY+J1hjcLXzx14Zhs="; 31 }; 32 33 patches = [ 34 # Numpy 2.x compatibility, https://github.com/quintusdias/glymur/pull/675 35 (fetchpatch { 36 name = "numpy2-compat.patch"; 37 url = "https://github.com/quintusdias/glymur/commit/89b159299035ebb05776c3b90278f410ca6dba64.patch"; 38 hash = "sha256-C/Q5WZmW5YtN3U8fxKljfqwKHtFLfR2LQ69Tj8SuIWg="; 39 }) 40 (replaceVars ./set-lib-paths.patch { 41 openjp2_lib = "${lib.getLib openjpeg}/lib/libopenjp2${stdenv.hostPlatform.extensions.sharedLibrary}"; 42 tiff_lib = "${lib.getLib libtiff}/lib/libtiff${stdenv.hostPlatform.extensions.sharedLibrary}"; 43 }) 44 ]; 45 46 postPatch = lib.optionalString (!stdenv.hostPlatform.isDarwin) '' 47 substituteInPlace glymur/lib/tiff.py \ 48 --replace-fail "glymur_config('c')" "ctypes.CDLL('${lib.getLib glibc}/lib/libc.so.6')" 49 ''; 50 51 __propagatedImpureHostDeps = lib.optional stdenv.hostPlatform.isDarwin "/usr/lib/libc.dylib"; 52 53 build-system = [ setuptools ]; 54 55 dependencies = [ 56 lxml 57 numpy 58 ]; 59 60 nativeCheckInputs = [ 61 pytestCheckHook 62 scikit-image 63 ]; 64 65 preCheck = '' 66 export PATH="$out/bin:$PATH" 67 ''; 68 69 disabledTestPaths = [ 70 # this test involves glymur's different ways of finding the openjpeg path on 71 # fsh systems by reading an .rc file and such, and is obviated by the patch 72 "tests/test_config.py" 73 ]; 74 75 pythonImportsCheck = [ "glymur" ]; 76 77 meta = { 78 description = "Tools for accessing JPEG2000 files"; 79 homepage = "https://github.com/quintusdias/glymur"; 80 changelog = "https://github.com/quintusdias/glymur/blob/${src.rev}/CHANGES.txt"; 81 license = lib.licenses.mit; 82 maintainers = with lib.maintainers; [ tomasajt ]; 83 }; 84}