Merge pull request #307098 from r-ryantm/auto-update/cilium-cli
[NixPkgs.git] / pkgs / development / python-modules / pydicom / default.nix
blob6bcb0c42fa583bd3a593fcf22ede85b5cd9dbf31
1 { lib
2 , stdenv
3 , buildPythonPackage
4 , fetchFromGitHub
5 , flit-core
6 , numpy
7 , pillow
8 , pytestCheckHook
9 , pythonOlder
10 , setuptools
13 let
14   pname = "pydicom";
15   version = "2.4.4";
17   src = fetchFromGitHub {
18     owner = "pydicom";
19     repo = "pydicom";
20     rev = "refs/tags/v${version}";
21     hash = "sha256-iJE1horEmdL7bKPn+NlZLgmtCbLZCZWQ8NjDBQPzXk8=";
22   };
24   # Pydicom needs pydicom-data to run some tests. If these files aren't downloaded
25   # before the package creation, it'll try to download during the checkPhase.
26   test_data = fetchFromGitHub {
27     owner = "pydicom";
28     repo = "pydicom-data";
29     rev = "cbb9b2148bccf0f550e3758c07aca3d0e328e768";
30     hash = "sha256-nF/j7pfcEpWHjjsqqTtIkW8hCEbuQ3J4IxpRk0qc1CQ=";
31   };
34 buildPythonPackage {
35   inherit pname version src;
36   pyproject = true;
38   disabled = pythonOlder "3.10";
40   patches = [
41     # backport of https://github.com/pydicom/pydicom/commit/2513a20cc41743a42bdb86f4cbb4873899b7823c
42     ./pillow-10.1.0-compat.patch
43   ];
45   nativeBuildInputs = [
46     flit-core
47   ];
49   propagatedBuildInputs = [
50     numpy
51     pillow
52     setuptools
53   ];
55   nativeCheckInputs = [
56     pytestCheckHook
57   ];
59   # Setting $HOME to prevent pytest to try to create a folder inside
60   # /homeless-shelter which is read-only.
61   # Linking pydicom-data dicom files to $HOME/.pydicom/data
62   preCheck = ''
63     export HOME=$TMP/test-home
64     mkdir -p $HOME/.pydicom/
65     ln -s ${test_data}/data_store/data $HOME/.pydicom/data
66   '';
68   disabledTests = [
69     # tries to remove a dicom inside $HOME/.pydicom/data/ and download it again
70     "test_fetch_data_files"
71   ] ++ lib.optionals stdenv.isAarch64 [
72     # https://github.com/pydicom/pydicom/issues/1386
73     "test_array"
74   ] ++ lib.optionals stdenv.isDarwin [
75     # flaky, hard to reproduce failure outside hydra
76     "test_time_check"
77   ];
79   pythonImportsCheck = [
80     "pydicom"
81   ];
83   meta = with lib; {
84     description = "Python package for working with DICOM files";
85     mainProgram = "pydicom";
86     homepage = "https://pydicom.github.io";
87     changelog = "https://github.com/pydicom/pydicom/releases/tag/v${version}";
88     license = licenses.mit;
89     maintainers = with maintainers; [ bcdarwin ];
90   };