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
|
2021-12-06 16:07:01 +00:00
|
|
|
, pythonOlder
|
2020-07-18 16:06:22 +00:00
|
|
|
, pytestCheckHook
|
2020-04-24 23:36:52 +00:00
|
|
|
, numpy
|
|
|
|
, pillow
|
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";
|
2023-02-02 18:25:31 +00:00
|
|
|
version = "2.3.1";
|
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}";
|
|
|
|
hash = "sha256-xt0aK908lLgNlpcI86OSxy96Z/PZnQh7+GXzJ0VMQGA=";
|
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";
|
2021-01-05 17:05:55 +00:00
|
|
|
rev = "bbb723879690bb77e077a6d57657930998e92bd5";
|
2022-05-18 14:49:53 +00:00
|
|
|
hash = "sha256-dCI1temvpNWiWJYVfQZKy/YJ4ad5B0e9hEKHJnEeqzk=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2021-01-05 17:05:55 +00:00
|
|
|
in
|
|
|
|
buildPythonPackage {
|
|
|
|
inherit pname version src;
|
2021-12-06 16:07:01 +00:00
|
|
|
disabled = pythonOlder "3.6";
|
2021-01-05 17:05:55 +00:00
|
|
|
|
2022-05-18 14:49:53 +00:00
|
|
|
format = "setuptools";
|
|
|
|
|
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";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ bcdarwin ];
|
|
|
|
};
|
|
|
|
}
|