mirror of
https://codeberg.org/guix/guix.git
synced 2025-10-02 02:15:12 +00:00
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>
This commit is contained in:
parent
d212967934
commit
b5a3db7c47
1 changed files with 24 additions and 3 deletions
|
@ -1309,7 +1309,11 @@ libraries designed for computer vision research and implementation.")
|
||||||
(outputs '("out" "python"))
|
(outputs '("out" "python"))
|
||||||
(arguments
|
(arguments
|
||||||
(list
|
(list
|
||||||
#:tests? #f ;tests require network access and external data
|
#:imported-modules (append %cmake-build-system-modules
|
||||||
|
%pyproject-build-system-modules)
|
||||||
|
#:modules '(((guix build pyproject-build-system) #:prefix py:)
|
||||||
|
(guix build cmake-build-system)
|
||||||
|
(guix build utils))
|
||||||
#:configure-flags
|
#:configure-flags
|
||||||
#~(list "-DITK_USE_GPU=ON"
|
#~(list "-DITK_USE_GPU=ON"
|
||||||
"-DITK_USE_SYSTEM_LIBRARIES=ON"
|
"-DITK_USE_SYSTEM_LIBRARIES=ON"
|
||||||
|
@ -1377,7 +1381,19 @@ libraries designed for computer vision research and implementation.")
|
||||||
(delete-file
|
(delete-file
|
||||||
(string-append
|
(string-append
|
||||||
"Modules/Remote/"
|
"Modules/Remote/"
|
||||||
"MorphologicalContourInterpolation.remote.cmake")))))))
|
"MorphologicalContourInterpolation.remote.cmake"))))
|
||||||
|
(add-after 'unpack 'fix-numpy-bool
|
||||||
|
(lambda _
|
||||||
|
;; <https://github.com/InsightSoftwareConsortium/ITK/pull/5402>
|
||||||
|
(substitute* (string-append "Wrapping/Generators/"
|
||||||
|
"Python/itk/support/types.py")
|
||||||
|
(("np\\.bool") "np.bool_"))))
|
||||||
|
(delete 'check) ;tests require network access and external data
|
||||||
|
(add-after 'install 'python-sanity-check
|
||||||
|
(lambda* (#:key inputs outputs tests? #:allow-other-keys)
|
||||||
|
(when tests?
|
||||||
|
(py:add-installed-pythonpath inputs outputs)
|
||||||
|
(invoke "python3" "-c" "import itk")))))))
|
||||||
(inputs (list eigen
|
(inputs (list eigen
|
||||||
expat
|
expat
|
||||||
fftw
|
fftw
|
||||||
|
@ -1397,6 +1413,7 @@ libraries designed for computer vision research and implementation.")
|
||||||
gcc-13
|
gcc-13
|
||||||
git-minimal
|
git-minimal
|
||||||
pkg-config
|
pkg-config
|
||||||
|
python-numpy ;for phase 'python-sanity-check
|
||||||
swig-next
|
swig-next
|
||||||
which
|
which
|
||||||
(origin
|
(origin
|
||||||
|
@ -1454,11 +1471,15 @@ combine the information contained in both.")
|
||||||
(string-prefix? "-DITK_USE_PYTHON_LIMITED_API=" flag)
|
(string-prefix? "-DITK_USE_PYTHON_LIMITED_API=" flag)
|
||||||
(string-prefix? "-DITK_USE_SYSTEM_CASTXML=" flag)
|
(string-prefix? "-DITK_USE_SYSTEM_CASTXML=" flag)
|
||||||
(string-prefix? "-DITK_USE_SYSTEM_SWIG=" flag))))
|
(string-prefix? "-DITK_USE_SYSTEM_SWIG=" flag))))
|
||||||
#$cf))))
|
#$cf))
|
||||||
|
((#:phases phases #~%standard-phases)
|
||||||
|
#~(modify-phases #$phases
|
||||||
|
(delete 'python-sanity-check)))))
|
||||||
(inputs (modify-inputs (package-inputs insight-toolkit)
|
(inputs (modify-inputs (package-inputs insight-toolkit)
|
||||||
(delete "python")))
|
(delete "python")))
|
||||||
(native-inputs (modify-inputs (package-native-inputs insight-toolkit)
|
(native-inputs (modify-inputs (package-native-inputs insight-toolkit)
|
||||||
(delete "castxml")
|
(delete "castxml")
|
||||||
|
(delete "python-numpy")
|
||||||
(delete "swig"))))))
|
(delete "swig"))))))
|
||||||
|
|
||||||
(define-public itk-snap
|
(define-public itk-snap
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue