summaryrefslogtreecommitdiff
path: root/gnu/packages/image-processing.scm
diff options
context:
space:
mode:
authorJake Forster <jakecameron.forster@gmail.com>2025-07-29 22:09:58 +0930
committerAndreas Enge <andreas@enge.fr>2025-08-11 18:57:23 +0200
commitb5a3db7c478f20542b6f960e7d27b1e78f900545 (patch)
tree5b64ed3d898b07258944113d99b0c788c6313f20 /gnu/packages/image-processing.scm
parentd2129679340e4d735af518b71ea9b539a8b61a74 (diff)
gnu: insight-toolkit: Fix Python module and add a test for it.
Insight Toolkit (ITK) Python module fails to import due to: AttributeError: module 'numpy' has no attribute 'bool' Implement the fix from here: <https://github.com/InsightSoftwareConsortium/ITK/pull/5402> While ITK's test suite is disabled for good reason, we can test that the Python module imports successfully. Importing the Python module requires NumPy. It is added as a native-input instead of a propagated-input because the "out" output is unrelated to Python. * gnu/packages/image-processing.scm (insight-toolkit)[arguments]: Remove '#tests? #f'. Add #:imported-modules and #:modules. <#:phases>: Delete 'check. Add 'fix-numpy-bool and 'python-sanity-check. [native-inputs]: Add python-numpy. (insight-toolkit-legacy)[arguments]: Remove inherited phase 'python-sanity-check. [native-inputs]: Remove inherited python-numpy. Change-Id: Ia6d14c22cbea9cd9877da36f8f72e2e34ff8a8a6 Signed-off-by: Andreas Enge <andreas@enge.fr>
Diffstat (limited to 'gnu/packages/image-processing.scm')
-rw-r--r--gnu/packages/image-processing.scm27
1 files changed, 24 insertions, 3 deletions
diff --git a/gnu/packages/image-processing.scm b/gnu/packages/image-processing.scm
index ab30dfa31d9..0f5cf2a3026 100644
--- a/gnu/packages/image-processing.scm
+++ b/gnu/packages/image-processing.scm
@@ -1309,7 +1309,11 @@ libraries designed for computer vision research and implementation.")
1309 (outputs '("out" "python")) 1309 (outputs '("out" "python"))
1310 (arguments 1310 (arguments
1311 (list 1311 (list
1312 #:tests? #f ;tests require network access and external data 1312 #:imported-modules (append %cmake-build-system-modules
1313 %pyproject-build-system-modules)
1314 #:modules '(((guix build pyproject-build-system) #:prefix py:)
1315 (guix build cmake-build-system)
1316 (guix build utils))
1313 #:configure-flags 1317 #:configure-flags
1314 #~(list "-DITK_USE_GPU=ON" 1318 #~(list "-DITK_USE_GPU=ON"
1315 "-DITK_USE_SYSTEM_LIBRARIES=ON" 1319 "-DITK_USE_SYSTEM_LIBRARIES=ON"
@@ -1377,7 +1381,19 @@ libraries designed for computer vision research and implementation.")
1377 (delete-file 1381 (delete-file
1378 (string-append 1382 (string-append
1379 "Modules/Remote/" 1383 "Modules/Remote/"
1380 "MorphologicalContourInterpolation.remote.cmake"))))))) 1384 "MorphologicalContourInterpolation.remote.cmake"))))
1385 (add-after 'unpack 'fix-numpy-bool
1386 (lambda _
1387 ;; <https://github.com/InsightSoftwareConsortium/ITK/pull/5402>
1388 (substitute* (string-append "Wrapping/Generators/"
1389 "Python/itk/support/types.py")
1390 (("np\\.bool") "np.bool_"))))
1391 (delete 'check) ;tests require network access and external data
1392 (add-after 'install 'python-sanity-check
1393 (lambda* (#:key inputs outputs tests? #:allow-other-keys)
1394 (when tests?
1395 (py:add-installed-pythonpath inputs outputs)
1396 (invoke "python3" "-c" "import itk")))))))
1381 (inputs (list eigen 1397 (inputs (list eigen
1382 expat 1398 expat
1383 fftw 1399 fftw
@@ -1397,6 +1413,7 @@ libraries designed for computer vision research and implementation.")
1397 gcc-13 1413 gcc-13
1398 git-minimal 1414 git-minimal
1399 pkg-config 1415 pkg-config
1416 python-numpy ;for phase 'python-sanity-check
1400 swig-next 1417 swig-next
1401 which 1418 which
1402 (origin 1419 (origin
@@ -1454,11 +1471,15 @@ combine the information contained in both.")
1454 (string-prefix? "-DITK_USE_PYTHON_LIMITED_API=" flag) 1471 (string-prefix? "-DITK_USE_PYTHON_LIMITED_API=" flag)
1455 (string-prefix? "-DITK_USE_SYSTEM_CASTXML=" flag) 1472 (string-prefix? "-DITK_USE_SYSTEM_CASTXML=" flag)
1456 (string-prefix? "-DITK_USE_SYSTEM_SWIG=" flag)))) 1473 (string-prefix? "-DITK_USE_SYSTEM_SWIG=" flag))))
1457 #$cf)))) 1474 #$cf))
1475 ((#:phases phases #~%standard-phases)
1476 #~(modify-phases #$phases
1477 (delete 'python-sanity-check)))))
1458 (inputs (modify-inputs (package-inputs insight-toolkit) 1478 (inputs (modify-inputs (package-inputs insight-toolkit)
1459 (delete "python"))) 1479 (delete "python")))
1460 (native-inputs (modify-inputs (package-native-inputs insight-toolkit) 1480 (native-inputs (modify-inputs (package-native-inputs insight-toolkit)
1461 (delete "castxml") 1481 (delete "castxml")
1482 (delete "python-numpy")
1462 (delete "swig")))))) 1483 (delete "swig"))))))
1463 1484
1464(define-public itk-snap 1485(define-public itk-snap