[PATCH] gnu: fenics: Fix build.

  • Done
  • quality assurance status badge
Details
2 participants
  • Andreas Enge
  • Paul Garlick
Owner
unassigned
Submitted by
Paul Garlick
Severity
normal

Debbugs page

P
P
Paul Garlick wrote 6 days ago
(address . guix-patches@gnu.org)(name . Paul Garlick)(address . pgarlick@tourbillion-technology.com)
20250704101021.3534721-1-pgarlick@tourbillion-technology.com
* gnu/packages/simulation.scm (fenics): Run guix style, improve
formatting.
[arguments] <phases>: Remove test module references to expired numpy
aliases in the 'pre-check' phase. Use '--deselect' instead of '--ignore'
to skip a test in the 'check' phase. Add a FIXME note to enable reading
and writing files in the binary HDF5 format.
---
gnu/packages/simulation.scm | 196 ++++++++++++++++++------------------
1 file changed, 99 insertions(+), 97 deletions(-)

Toggle diff (214 lines)
diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm
index e6f86fb736..7d7668f117 100644
--- a/gnu/packages/simulation.scm
+++ b/gnu/packages/simulation.scm
@@ -917,108 +917,110 @@ (define-public fenics
(list fenics-dolfin
python-petsc4py
python-slepc4py
-
- ;; 'dolfin/jit/jit.py' parses 'dolfin.pc' at run time.
+ ;; 'dolfin/jit/jit.py' parses 'dolfin.pc' at runtime.
python-pkgconfig))
(arguments
- (list #:phases
- #~(modify-phases %standard-phases
- (add-after 'unpack 'relax-requirements
- (lambda _
- (substitute* "python/setup.py"
- (("pybind11==")
- "pybind11>="))))
- (add-after 'unpack 'set-dolfin-pc-file-name
- (lambda* (#:key inputs #:allow-other-keys)
- ;; Instead of cluttering the user's 'PKG_CONFIG_PATH' environment
- ;; variable, hard-code the 'dolfin.pc' absolute file name.
- (let ((pc-file (search-input-file inputs
- "/lib/pkgconfig/dolfin.pc")))
- (substitute* "python/dolfin/jit/jit.py"
- (("pkgconfig\\.parse\\(\"dolfin\"\\)")
- (string-append "pkgconfig.parse(\"" pc-file
- "\")"))))))
- (add-after 'patch-source-shebangs 'set-paths
- (lambda _
- ;; Define paths to store locations.
- (setenv "PYBIND11_DIR" #$(this-package-input "pybind11"))
- ;; Move to python sub-directory.
- (chdir "python")))
- (add-after 'build 'mpi-setup
- #$%openmpi-setup)
- (add-before 'check 'pre-check
- (lambda _
- ;; Exclude three tests that generate
- ;; 'NotImplementedError' in matplotlib version 3.1.2.
- ;; See
- ;; <https://github.com/matplotlib/matplotlib/issues/15382>.
- ;; Also exclude tests that require meshes supplied by
- ;; git-lfs.
- (substitute* "demo/test.py"
- (("(.*stem !.*)" line)
- (string-append line
- "\n"
- "excludeList = [\n"
- "'built-in-meshes', \n"
- "'hyperelasticity', \n"
- "'elasticity', \n"
- "'multimesh-quadrature', \n"
- "'multimesh-marking', \n"
- "'mixed-poisson-sphere', \n"
- "'mesh-quality', \n"
- "'lift-drag', \n"
- "'elastodynamics', \n"
- "'dg-advection-diffusion', \n"
- "'curl-curl', \n"
- "'contact-vi-tao', \n"
- "'contact-vi-snes', \n"
- "'collision-detection', \n"
- "'buckling-tao', \n"
- "'auto-adaptive-navier-stokes', \n"
- "'advection-diffusion', \n"
- "'subdomains', \n"
- "'stokes-taylor-hood', \n"
- "'stokes-mini', \n"
- "'navier-stokes', \n"
- "'eigenvalue']\n"
- "demos = ["
- "d for d in demos if d[0].stem not in "
- "excludeList]\n")))
- (setenv "HOME"
- (getcwd))
- ;; Restrict OpenBLAS to MPI-only in preference to MPI+OpenMP.
- (setenv "OPENBLAS_NUM_THREADS" "1")))
- (replace 'check
- (lambda* (#:key tests? #:allow-other-keys)
- (when tests?
- (with-directory-excursion "test"
- (invoke "pytest"
- "unit"
- ;; The test test_snes_set_from_options() in the file
- ;; unit/nls/test_PETScSNES_solver.py fails and is ignored.
- "--ignore"
- "unit/nls/test_PETScSNES_solver.py"
- ;; Fails with a segfault.
- "--ignore"
- "unit/io/test_XDMF.py")))))
- (add-after 'install 'install-demo-files
- (lambda* (#:key outputs #:allow-other-keys)
- (let* ((demos (string-append (assoc-ref outputs "out")
- "/share/python-dolfin/demo")))
- (mkdir-p demos)
- (with-directory-excursion "demo"
- (for-each (lambda (file)
- (let* ((dir (dirname file))
- (tgt-dir (string-append
- demos "/" dir)))
- (unless (equal? "." dir)
- (mkdir-p tgt-dir)
- (install-file file tgt-dir))))
- (find-files "." ".*\\.(py|gz|xdmf)$")))))))))
+ (list
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'relax-requirements
+ (lambda _
+ (substitute* "python/setup.py"
+ (("pybind11==") "pybind11>="))))
+ (add-after 'unpack 'set-dolfin-pc-file-name
+ (lambda* (#:key inputs #:allow-other-keys)
+ ;; Instead of cluttering the user's PKG_CONFIG_PATH environment
+ ;; variable, hard-code the 'dolfin.pc' absolute file name.
+ (let ((pc-file (search-input-file inputs
+ "/lib/pkgconfig/dolfin.pc")))
+ (substitute* "python/dolfin/jit/jit.py"
+ (("pkgconfig\\.parse\\(\"dolfin\"\\)")
+ (string-append "pkgconfig.parse(\"" pc-file "\")"))))))
+ (add-after 'patch-source-shebangs 'set-paths
+ (lambda _
+ ;; Define paths to store locations.
+ (setenv "PYBIND11_DIR" #$(this-package-input "pybind11"))
+ ;; Move to python sub-directory.
+ (chdir "python")))
+ (add-after 'build 'mpi-setup
+ #$%openmpi-setup)
+ (add-before 'check 'pre-check
+ (lambda _
+ ;; Exclude three tests that generate 'NotImplementedError' in
+ ;; matplotlib v3.1.2. See
+ ;; <https://github.com/matplotlib/matplotlib/issues/15382>.
+ ;; Also exclude tests that require meshes supplied by git-lfs.
+ (substitute* "demo/test.py"
+ (("(.*stem !.*)" line)
+ (string-append line
+ "\n"
+ "excludeList = [\n"
+ "'built-in-meshes', \n"
+ "'hyperelasticity', \n"
+ "'elasticity', \n"
+ "'multimesh-quadrature', \n"
+ "'multimesh-marking', \n"
+ "'mixed-poisson-sphere', \n"
+ "'mesh-quality', \n"
+ "'lift-drag', \n"
+ "'elastodynamics', \n"
+ "'dg-advection-diffusion', \n"
+ "'curl-curl', \n"
+ "'contact-vi-tao', \n"
+ "'contact-vi-snes', \n"
+ "'collision-detection', \n"
+ "'buckling-tao', \n"
+ "'auto-adaptive-navier-stokes', \n"
+ "'advection-diffusion', \n"
+ "'subdomains', \n"
+ "'stokes-taylor-hood', \n"
+ "'stokes-mini', \n"
+ "'navier-stokes', \n"
+ "'eigenvalue']\n"
+ "demos = ["
+ "d for d in demos if d[0].stem not "
+ "in excludeList]\n")))
+ ;; Do not test for expired numpy aliases.
+ (substitute* "test/unit/la/test_vector.py"
+ ((" numpy.float\\(42.0\\),") "")
+ (("^.*numpy.int\\(42.0\\).*$") ""))
+ (substitute* "test/unit/la/test_la_basic.py"
+ ((" int,") " ")
+ (("\\[int,") "["))
+ (setenv "HOME" (getcwd))
+ ;; Restrict OpenBLAS to MPI-only in preference to MPI+OpenMP.
+ (setenv "OPENBLAS_NUM_THREADS" "1")))
+ (replace 'check
+ (lambda* (#:key tests? #:allow-other-keys)
+ (when tests?
+ (with-directory-excursion "test"
+ (invoke "pytest"
+ "unit"
+ ;; This test fails and is ignored.
+ "--deselect"
+ "unit/nls/test_PETScSNES_solver.py::test_snes_set_from_options"
+ ;; FIXME: Tests with binary encoded hdf5 files fail with a
+ ;; segfault. See fenics-project DOLFIN commit 6fbc9fb.
+ "--ignore"
+ "unit/io/test_XDMF.py")))))
+ (add-after 'install 'install-demo-files
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((demos (string-append (assoc-ref outputs "out")
+ "/share/python-dolfin/demo")))
+ (mkdir-p demos)
+ (with-directory-excursion "demo"
+ (for-each (lambda (file)
+ (let* ((dir (dirname file))
+ (tgt-dir (string-append demos
+ "/" dir)))
+ (unless (equal? "." dir)
+ (mkdir-p tgt-dir)
+ (install-file file tgt-dir))))
+ (find-files "." ".*\\.(py|gz|xdmf)$")))))))))
(home-page "https://fenicsproject.org/")
(synopsis "High-level environment for solving differential equations")
(description
- "@code{fenics} is a computing platform for solving general classes of
+ "@code{fenics} is a computing platform for solving general classes of
problems that involve differential equations. @code{fenics} facilitates
access to efficient methods for dealing with ordinary differential
equations (ODEs) and partial differential equations (PDEs). Systems of
--
2.39.5
A
A
Andreas Enge wrote 5 days ago
(name . Paul Garlick)(address . pgarlick@tourbillion-technology.com)(address . 78954-done@debbugs.gnu.org)
aGk6w5KXBGxGFSMU@jurong
Thanks a lot for your detective work!

I could build the package locally and have pushed to master.

Andreas
Closed
?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 78954@patchwise.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 78954
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch