2021-01-25 08:26:54 +00:00
|
|
|
{ lib
|
2020-01-16 18:58:51 +00:00
|
|
|
, buildPythonPackage
|
2020-12-24 22:46:29 +00:00
|
|
|
, fetchFromGitHub
|
2020-06-26 05:54:41 +01:00
|
|
|
, isPy27
|
2020-01-16 18:58:51 +00:00
|
|
|
, pytestrunner
|
2020-07-16 20:24:54 +01:00
|
|
|
, pytestCheckHook
|
2020-01-16 18:58:51 +00:00
|
|
|
, numpy
|
|
|
|
, pillow
|
|
|
|
}:
|
|
|
|
|
2020-12-24 22:46:29 +00:00
|
|
|
let
|
2020-01-16 18:58:51 +00:00
|
|
|
pname = "pydicom";
|
2020-12-24 22:46:29 +00:00
|
|
|
version = "2.1.2";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "${pname}";
|
|
|
|
repo = "${pname}";
|
|
|
|
rev = "v${version}";
|
|
|
|
sha256 = "sha256-iExy+mUs1uqs/u9N6btlqyP6/TvoPVsuOuzs56zZAS8=";
|
|
|
|
};
|
2020-01-16 18:58:51 +00:00
|
|
|
|
2020-12-24 22:46:29 +00:00
|
|
|
# Pydicom needs pydicom-data to run some tests. If these files are downloaded
|
|
|
|
# before the package creation, it'll try to download during the checkPhase.
|
|
|
|
test_data = fetchFromGitHub {
|
|
|
|
owner = "${pname}";
|
|
|
|
repo = "${pname}-data";
|
|
|
|
rev = "bbb723879690bb77e077a6d57657930998e92bd5";
|
|
|
|
sha256 = "sha256-dCI1temvpNWiWJYVfQZKy/YJ4ad5B0e9hEKHJnEeqzk=";
|
2020-01-16 18:58:51 +00:00
|
|
|
};
|
|
|
|
|
2020-12-24 22:46:29 +00:00
|
|
|
in
|
|
|
|
buildPythonPackage {
|
|
|
|
inherit pname version src;
|
|
|
|
disabled = isPy27;
|
|
|
|
|
2020-01-16 18:58:51 +00:00
|
|
|
propagatedBuildInputs = [ numpy pillow ];
|
2020-07-16 20:24:54 +01:00
|
|
|
|
2020-12-24 22:46:29 +00:00
|
|
|
checkInputs = [ pytestrunner pytestCheckHook ];
|
|
|
|
|
|
|
|
# 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
|
|
|
|
'';
|
|
|
|
|
|
|
|
# This test try to remove a dicom inside $HOME/.pydicom/data/ and download it again.
|
|
|
|
disabledTests = [
|
|
|
|
"test_fetch_data_files"
|
|
|
|
];
|
2020-01-16 18:58:51 +00:00
|
|
|
|
2021-01-11 07:54:33 +00:00
|
|
|
meta = with lib; {
|
2020-04-01 02:11:51 +01:00
|
|
|
homepage = "https://pydicom.github.io";
|
2020-01-16 18:58:51 +00:00
|
|
|
description = "Pure-Python package for working with DICOM files";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ bcdarwin ];
|
|
|
|
};
|
|
|
|
}
|