From 8d4076fc119dc8a35f54bcfb487fbc6104c07a8c Mon Sep 17 00:00:00 2001 From: Ben Darwin Date: Thu, 7 Nov 2024 13:04:04 -0500 Subject: [PATCH 1/3] python312Packages.gdcm: unbreak --- pkgs/development/libraries/gdcm/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/development/libraries/gdcm/default.nix b/pkgs/development/libraries/gdcm/default.nix index 50ad7bdd9fd6..befb715e2583 100644 --- a/pkgs/development/libraries/gdcm/default.nix +++ b/pkgs/development/libraries/gdcm/default.nix @@ -77,6 +77,8 @@ stdenv.mkDerivation rec { "TestSCUValidation" # errors because 3 classes not wrapped: "TestWrapPython" + # AttributeError: module 'gdcm' has no attribute 'UIDGenerator_SetRoot'; maybe a wrapping regression: + "TestUIDGeneratorPython" ] ++ lib.optionals (stdenv.hostPlatform.isAarch64 && stdenv.hostPlatform.isLinux) [ "TestRescaler2" ]; From 8b5639863029ab9d121377c7efb29eed832e32ac Mon Sep 17 00:00:00 2001 From: Ben Darwin Date: Thu, 7 Nov 2024 13:04:37 -0500 Subject: [PATCH 2/3] python312Packages.gdcm: add egg-info file --- pkgs/development/libraries/gdcm/default.nix | 9 ++++++++- pkgs/development/libraries/gdcm/python_gdcm.egg-info | 5 +++++ pkgs/development/python-modules/dicom2nifti/default.nix | 4 ---- 3 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 pkgs/development/libraries/gdcm/python_gdcm.egg-info diff --git a/pkgs/development/libraries/gdcm/default.nix b/pkgs/development/libraries/gdcm/default.nix index befb715e2583..ca099da02354 100644 --- a/pkgs/development/libraries/gdcm/default.nix +++ b/pkgs/development/libraries/gdcm/default.nix @@ -45,7 +45,7 @@ stdenv.mkDerivation rec { "-DGDCM_USE_VTK=ON" ] ++ lib.optionals enablePython [ "-DGDCM_WRAP_PYTHON:BOOL=ON" - "-DGDCM_INSTALL_PYTHONMODULE_DIR=${placeholder "out"}/${python.sitePackages}" + "-DGDCM_INSTALL_PYTHONMODULE_DIR=${placeholder "out"}/${python.sitePackages}/python_gdcm" ]; nativeBuildInputs = [ @@ -66,6 +66,13 @@ stdenv.mkDerivation rec { libiconv ] ++ lib.optionals enablePython [ swig python ]; + postInstall = lib.optionalString enablePython '' + substitute \ + ${./python_gdcm.egg-info} \ + $out/${python.sitePackages}/python_gdcm-${version}.egg-info \ + --subst-var-by GDCM_VER "${version}" + ''; + disabledTests = [ # require networking: "TestEcho" diff --git a/pkgs/development/libraries/gdcm/python_gdcm.egg-info b/pkgs/development/libraries/gdcm/python_gdcm.egg-info new file mode 100644 index 000000000000..d0b2e21f091d --- /dev/null +++ b/pkgs/development/libraries/gdcm/python_gdcm.egg-info @@ -0,0 +1,5 @@ +Metadata-Version: 2.1 +Name: python-gdcm +Version: @GDCM_VER@ +Summary: C++ library for DICOM medical files wrapped for Python using SWIG +Platform: UNKNOWN diff --git a/pkgs/development/python-modules/dicom2nifti/default.nix b/pkgs/development/python-modules/dicom2nifti/default.nix index 0e12fe09c775..fae02acae762 100644 --- a/pkgs/development/python-modules/dicom2nifti/default.nix +++ b/pkgs/development/python-modules/dicom2nifti/default.nix @@ -37,11 +37,7 @@ buildPythonPackage rec { scipy ]; - # python-gdcm just builds the python interface provided by the "gdcm" package, so - # we should be able to replace "python-gdcm" with "gdcm" but this doesn't work - # (similar to https://github.com/NixOS/nixpkgs/issues/84774) postPatch = '' - substituteInPlace setup.py --replace-fail "python-gdcm" "" substituteInPlace tests/test_generic.py --replace-fail "from common" "from dicom2nifti.common" substituteInPlace tests/test_ge.py --replace-fail "import convert_generic" "import dicom2nifti.convert_generic as convert_generic" ''; From fd5675dbe34cec9960abe161076398a6bcfd3f2a Mon Sep 17 00:00:00 2001 From: Ben Darwin Date: Thu, 7 Nov 2024 13:53:05 -0500 Subject: [PATCH 3/3] python312Packages.dicom2nifti: unbreak tests --- pkgs/development/python-modules/dicom2nifti/default.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/pkgs/development/python-modules/dicom2nifti/default.nix b/pkgs/development/python-modules/dicom2nifti/default.nix index fae02acae762..a3b123f84302 100644 --- a/pkgs/development/python-modules/dicom2nifti/default.nix +++ b/pkgs/development/python-modules/dicom2nifti/default.nix @@ -8,6 +8,8 @@ nibabel, numpy, pydicom, + pylibjpeg, + pylibjpeg-libjpeg, scipy, setuptools, }: @@ -42,7 +44,11 @@ buildPythonPackage rec { substituteInPlace tests/test_ge.py --replace-fail "import convert_generic" "import dicom2nifti.convert_generic as convert_generic" ''; - nativeCheckInputs = [ pytestCheckHook ]; + nativeCheckInputs = [ + pytestCheckHook + pylibjpeg + pylibjpeg-libjpeg + ]; pythonImportsCheck = [ "dicom2nifti" ];