at 23.05-pre 1.9 kB view raw
1{ lib 2, stdenv 3, buildPythonPackage 4, fetchFromGitHub 5, pythonOlder 6, pytestCheckHook 7, numpy 8, pillow 9, setuptools 10}: 11 12let 13 pname = "pydicom"; 14 version = "2.3.0"; 15 16 src = fetchFromGitHub { 17 owner = "pydicom"; 18 repo = "pydicom"; 19 rev = "v${version}"; 20 hash = "sha256-CAQWaBkzecJ1VXQ5BnAUjmBMjh0I8y+gT7I4P4o2gqI="; 21 }; 22 23 # Pydicom needs pydicom-data to run some tests. If these files aren't downloaded 24 # before the package creation, it'll try to download during the checkPhase. 25 test_data = fetchFromGitHub { 26 owner = "pydicom"; 27 repo = "pydicom-data"; 28 rev = "bbb723879690bb77e077a6d57657930998e92bd5"; 29 hash = "sha256-dCI1temvpNWiWJYVfQZKy/YJ4ad5B0e9hEKHJnEeqzk="; 30 }; 31 32in 33buildPythonPackage { 34 inherit pname version src; 35 disabled = pythonOlder "3.6"; 36 37 format = "setuptools"; 38 39 propagatedBuildInputs = [ 40 numpy 41 pillow 42 setuptools 43 ]; 44 45 checkInputs = [ 46 pytestCheckHook 47 ]; 48 49 # Setting $HOME to prevent pytest to try to create a folder inside 50 # /homeless-shelter which is read-only. 51 # Linking pydicom-data dicom files to $HOME/.pydicom/data 52 preCheck = '' 53 export HOME=$TMP/test-home 54 mkdir -p $HOME/.pydicom/ 55 ln -s ${test_data}/data_store/data $HOME/.pydicom/data 56 ''; 57 58 disabledTests = [ 59 # tries to remove a dicom inside $HOME/.pydicom/data/ and download it again 60 "test_fetch_data_files" 61 ] ++ lib.optionals stdenv.isAarch64 [ 62 # https://github.com/pydicom/pydicom/issues/1386 63 "test_array" 64 ] ++ lib.optionals stdenv.isDarwin [ 65 # flaky, hard to reproduce failure outside hydra 66 "test_time_check" 67 ]; 68 69 pythonImportsCheck = [ 70 "pydicom" 71 ]; 72 73 meta = with lib; { 74 description = "Python package for working with DICOM files"; 75 homepage = "https://pydicom.github.io"; 76 license = licenses.mit; 77 maintainers = with maintainers; [ bcdarwin ]; 78 }; 79}