2021-02-05 17:12:51 +00:00
|
|
|
{ lib
|
2021-05-20 23:08:51 +00:00
|
|
|
, stdenv
|
2020-04-24 23:36:52 +00:00
|
|
|
, buildPythonPackage
|
2021-01-05 17:05:55 +00:00
|
|
|
, fetchFromGitHub
|
2024-01-25 14:12:00 +00:00
|
|
|
, flit-core
|
2020-04-24 23:36:52 +00:00
|
|
|
, numpy
|
|
|
|
, pillow
|
2024-01-25 14:12:00 +00:00
|
|
|
, pytestCheckHook
|
|
|
|
, pythonOlder
|
2021-12-06 16:07:01 +00:00
|
|
|
, setuptools
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
2021-01-05 17:05:55 +00:00
|
|
|
let
|
2020-04-24 23:36:52 +00:00
|
|
|
pname = "pydicom";
|
2024-01-25 14:12:00 +00:00
|
|
|
version = "2.4.4";
|
2021-01-05 17:05:55 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2022-05-18 14:49:53 +00:00
|
|
|
owner = "pydicom";
|
|
|
|
repo = "pydicom";
|
2023-02-02 18:25:31 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
2024-01-25 14:12:00 +00:00
|
|
|
hash = "sha256-iJE1horEmdL7bKPn+NlZLgmtCbLZCZWQ8NjDBQPzXk8=";
|
2021-01-05 17:05:55 +00:00
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-06 16:07:01 +00:00
|
|
|
# Pydicom needs pydicom-data to run some tests. If these files aren't downloaded
|
2021-01-05 17:05:55 +00:00
|
|
|
# before the package creation, it'll try to download during the checkPhase.
|
|
|
|
test_data = fetchFromGitHub {
|
2022-05-18 14:49:53 +00:00
|
|
|
owner = "pydicom";
|
|
|
|
repo = "pydicom-data";
|
2023-08-22 20:05:09 +00:00
|
|
|
rev = "cbb9b2148bccf0f550e3758c07aca3d0e328e768";
|
|
|
|
hash = "sha256-nF/j7pfcEpWHjjsqqTtIkW8hCEbuQ3J4IxpRk0qc1CQ=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-01-05 17:05:55 +00:00
|
|
|
in
|
|
|
|
buildPythonPackage {
|
|
|
|
inherit pname version src;
|
2024-01-25 14:12:00 +00:00
|
|
|
pyproject = true;
|
2021-01-05 17:05:55 +00:00
|
|
|
|
2024-01-25 14:12:00 +00:00
|
|
|
disabled = pythonOlder "3.10";
|
2022-05-18 14:49:53 +00:00
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
patches = [
|
|
|
|
# backport of https://github.com/pydicom/pydicom/commit/2513a20cc41743a42bdb86f4cbb4873899b7823c
|
|
|
|
./pillow-10.1.0-compat.patch
|
|
|
|
];
|
|
|
|
|
2024-01-25 14:12:00 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
flit-core
|
|
|
|
];
|
|
|
|
|
2021-12-30 13:39:12 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
numpy
|
|
|
|
pillow
|
|
|
|
setuptools
|
|
|
|
];
|
2020-07-18 16:06:22 +00:00
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2021-12-30 13:39:12 +00:00
|
|
|
pytestCheckHook
|
|
|
|
];
|
2021-01-05 17:05:55 +00:00
|
|
|
|
|
|
|
# Setting $HOME to prevent pytest to try to create a folder inside
|
|
|
|
# /homeless-shelter which is read-only.
|
|
|
|
# Linking pydicom-data dicom files to $HOME/.pydicom/data
|
|
|
|
preCheck = ''
|
|
|
|
export HOME=$TMP/test-home
|
|
|
|
mkdir -p $HOME/.pydicom/
|
|
|
|
ln -s ${test_data}/data_store/data $HOME/.pydicom/data
|
|
|
|
'';
|
|
|
|
|
|
|
|
disabledTests = [
|
2022-05-18 14:49:53 +00:00
|
|
|
# tries to remove a dicom inside $HOME/.pydicom/data/ and download it again
|
2021-01-05 17:05:55 +00:00
|
|
|
"test_fetch_data_files"
|
2021-05-20 23:08:51 +00:00
|
|
|
] ++ lib.optionals stdenv.isAarch64 [
|
|
|
|
# https://github.com/pydicom/pydicom/issues/1386
|
|
|
|
"test_array"
|
2021-05-28 09:39:13 +00:00
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
# flaky, hard to reproduce failure outside hydra
|
|
|
|
"test_time_check"
|
2021-01-05 17:05:55 +00:00
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-12-30 13:39:12 +00:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"pydicom"
|
|
|
|
];
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2021-12-30 13:39:12 +00:00
|
|
|
description = "Python package for working with DICOM files";
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://pydicom.github.io";
|
2024-01-25 14:12:00 +00:00
|
|
|
changelog = "https://github.com/pydicom/pydicom/releases/tag/v${version}";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ bcdarwin ];
|
|
|
|
};
|
|
|
|
}
|