python312Packages.pydicom: 2.4.4 -> 3.0.1; unbreak (#368584)
This commit is contained in:
@@ -2,13 +2,13 @@
|
||||
lib,
|
||||
buildPythonPackage,
|
||||
fetchPypi,
|
||||
pythonAtLeast,
|
||||
pythonOlder,
|
||||
hatchling,
|
||||
hatch-vcs,
|
||||
numpy,
|
||||
packaging,
|
||||
importlib-resources,
|
||||
typing-extensions,
|
||||
pydicom,
|
||||
pillow,
|
||||
h5py,
|
||||
@@ -22,25 +22,28 @@
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "nibabel";
|
||||
version = "5.2.1";
|
||||
version = "5.3.2";
|
||||
pyproject = true;
|
||||
|
||||
disabled = pythonOlder "3.8";
|
||||
disabled = pythonOlder "3.9";
|
||||
|
||||
src = fetchPypi {
|
||||
inherit pname version;
|
||||
hash = "sha256-tsgLLnKOS8K2XxFC2bjSKHqRAqi/hHfhFe8NgzRVmXU=";
|
||||
hash = "sha256-C9ymUDsceEtEbHRaRUI2fed1bPug1yFDuR+f+3i+Vps=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
build-system = [
|
||||
hatchling
|
||||
hatch-vcs
|
||||
];
|
||||
|
||||
propagatedBuildInputs = [
|
||||
numpy
|
||||
packaging
|
||||
] ++ lib.optionals (pythonOlder "3.9") [ importlib-resources ];
|
||||
dependencies =
|
||||
[
|
||||
numpy
|
||||
packaging
|
||||
]
|
||||
++ lib.optionals (pythonOlder "3.12") [ importlib-resources ]
|
||||
++ lib.optionals (pythonOlder "3.13") [ typing-extensions ];
|
||||
|
||||
optional-dependencies = rec {
|
||||
all = dicom ++ dicomfs ++ minc2 ++ spm ++ zstd;
|
||||
@@ -65,11 +68,6 @@ buildPythonPackage rec {
|
||||
export PATH=$out/bin:$PATH
|
||||
'';
|
||||
|
||||
disabledTestPaths = lib.optionals (pythonAtLeast "3.12") [
|
||||
# uses distutils
|
||||
"nisext/tests/test_sexts.py"
|
||||
];
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://nipy.org/nibabel";
|
||||
changelog = "https://github.com/nipy/nibabel/blob/${version}/Changelog";
|
||||
|
||||
@@ -3,54 +3,59 @@
|
||||
stdenv,
|
||||
buildPythonPackage,
|
||||
fetchFromGitHub,
|
||||
pythonOlder,
|
||||
flit-core,
|
||||
numpy,
|
||||
pillow,
|
||||
pytestCheckHook,
|
||||
pythonOlder,
|
||||
setuptools,
|
||||
|
||||
# optional/test dependencies
|
||||
gdcm,
|
||||
pillow,
|
||||
pylibjpeg,
|
||||
pylibjpeg-libjpeg,
|
||||
}:
|
||||
|
||||
let
|
||||
pname = "pydicom";
|
||||
version = "2.4.4";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "pydicom";
|
||||
repo = "pydicom";
|
||||
rev = "refs/tags/v${version}";
|
||||
hash = "sha256-iJE1horEmdL7bKPn+NlZLgmtCbLZCZWQ8NjDBQPzXk8=";
|
||||
};
|
||||
|
||||
# Pydicom needs pydicom-data to run some tests. If these files aren't downloaded
|
||||
# before the package creation, it'll try to download during the checkPhase.
|
||||
test_data = fetchFromGitHub {
|
||||
owner = "pydicom";
|
||||
repo = "pydicom-data";
|
||||
rev = "cbb9b2148bccf0f550e3758c07aca3d0e328e768";
|
||||
hash = "sha256-nF/j7pfcEpWHjjsqqTtIkW8hCEbuQ3J4IxpRk0qc1CQ=";
|
||||
rev = "8da482f208401d63cd63f3f4efc41b6856ef36c7";
|
||||
hash = "sha256-ji7SppKdiszaXs8yCSIPkJj4Ld++XWNw9FuxLoFLfFo=";
|
||||
};
|
||||
in
|
||||
buildPythonPackage {
|
||||
inherit pname version src;
|
||||
buildPythonPackage rec {
|
||||
pname = "pydicom";
|
||||
version = "3.0.1";
|
||||
pyproject = true;
|
||||
|
||||
disabled = pythonOlder "3.10";
|
||||
|
||||
patches = [
|
||||
# backport of https://github.com/pydicom/pydicom/commit/2513a20cc41743a42bdb86f4cbb4873899b7823c
|
||||
./pillow-10.1.0-compat.patch
|
||||
];
|
||||
src = fetchFromGitHub {
|
||||
owner = "pydicom";
|
||||
repo = "pydicom";
|
||||
tag = "v${version}";
|
||||
hash = "sha256-SvRevQehRaSp+vCtJRQVEJiC5noIJS+bGG1/q4p7/XU=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ flit-core ];
|
||||
build-system = [ flit-core ];
|
||||
|
||||
propagatedBuildInputs = [
|
||||
dependencies = [
|
||||
numpy
|
||||
pillow
|
||||
setuptools
|
||||
];
|
||||
|
||||
nativeCheckInputs = [ pytestCheckHook ];
|
||||
optional-dependencies = {
|
||||
pixeldata = [
|
||||
pillow
|
||||
#pyjpegls # not in nixpkgs
|
||||
#pylibjpeg.optional-dependencies.openjpeg # infinite recursion
|
||||
#pylibjpeg.optional-dependencies.rle # not in nixpkgs
|
||||
pylibjpeg-libjpeg
|
||||
gdcm
|
||||
];
|
||||
};
|
||||
|
||||
nativeCheckInputs = [ pytestCheckHook ] ++ optional-dependencies.pixeldata;
|
||||
|
||||
# Setting $HOME to prevent pytest to try to create a folder inside
|
||||
# /homeless-shelter which is read-only.
|
||||
@@ -65,6 +70,14 @@ buildPythonPackage {
|
||||
[
|
||||
# tries to remove a dicom inside $HOME/.pydicom/data/ and download it again
|
||||
"test_fetch_data_files"
|
||||
|
||||
# test_reference_expl{,_binary}[parametric_map_float.dcm] tries to download that file for some reason even though it's present in test-data
|
||||
"test_reference_expl"
|
||||
"test_reference_expl_binary"
|
||||
|
||||
# slight error in regex matching
|
||||
"test_no_decoders_raises"
|
||||
"test_deepcopy_bufferedreader_raises"
|
||||
]
|
||||
++ lib.optionals stdenv.hostPlatform.isAarch64 [
|
||||
# https://github.com/pydicom/pydicom/issues/1386
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
diff --git a/pydicom/pixel_data_handlers/pillow_handler.py b/pydicom/pixel_data_handlers/pillow_handler.py
|
||||
index ff781025d..a44eb9a41 100644
|
||||
--- a/pydicom/pixel_data_handlers/pillow_handler.py
|
||||
+++ b/pydicom/pixel_data_handlers/pillow_handler.py
|
||||
@@ -119,18 +119,12 @@ def _decompress_single_frame(
|
||||
# space prior to compression, setting the value of "mode" to YCbCr
|
||||
# signals Pillow to not apply any color transformation upon
|
||||
# decompression.
|
||||
- if (transfer_syntax in PillowJPEGTransferSyntaxes and
|
||||
- photometric_interpretation == 'RGB'):
|
||||
- if 'adobe_transform' not in image.info:
|
||||
- color_mode = 'YCbCr'
|
||||
- image.tile = [(
|
||||
- 'jpeg',
|
||||
- image.tile[0][1],
|
||||
- image.tile[0][2],
|
||||
- (color_mode, ''),
|
||||
- )]
|
||||
- image.mode = color_mode
|
||||
- image.rawmode = color_mode
|
||||
+ if (
|
||||
+ transfer_syntax in PillowJPEGTransferSyntaxes
|
||||
+ and photometric_interpretation == 'RGB'
|
||||
+ and "adobe_transform" not in image.info
|
||||
+ ):
|
||||
+ image.draft("YCbCr", image.size)
|
||||
return image
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
pydicom,
|
||||
pylibjpeg-data,
|
||||
pylibjpeg-libjpeg,
|
||||
pylibjpeg-openjpeg,
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
@@ -29,6 +30,12 @@ buildPythonPackage rec {
|
||||
|
||||
dependencies = [ numpy ];
|
||||
|
||||
optional-dependencies = {
|
||||
libjpeg = [ pylibjpeg-libjpeg ];
|
||||
openjpeg = [ pylibjpeg-openjpeg ];
|
||||
#rle = [ pylibjpeg-rle ]; # not in Nixpkgs
|
||||
};
|
||||
|
||||
nativeCheckInputs = [
|
||||
pytestCheckHook
|
||||
pydicom
|
||||
|
||||
Reference in New Issue
Block a user