diff options
| author | Nicolas Graves <ngraves@ngraves.fr> | 2025-11-23 11:44:29 +0100 |
|---|---|---|
| committer | Sharlatan Hellseher <sharlatanus@gmail.com> | 2025-11-26 21:22:06 +0000 |
| commit | c63083b2a14bbeb973c20c2a00d1cc58b19ad5f3 (patch) | |
| tree | bec047866b858d3eff1d7bcee31fa18eb2b68651 /gnu/packages/simulation.scm | |
| parent | 99e0ae24312c4e5905715132e3860db2a61ee6aa (diff) | |
gnu: fenics: Switch to pyproject.
* gnu/packages/simulation.scm (fenics):
[build-system]: Switch to pyproject-build-system.
[arguments]: Relocate field, improve style.
<#:test-flags>: Use them, and skip flaky tests.
[native-inputs]: Add python-setuptools.
Change-Id: I85825ec6aa2a68db74cb7b5864103bbf34c33031
Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
Diffstat (limited to 'gnu/packages/simulation.scm')
| -rw-r--r-- | gnu/packages/simulation.scm | 121 |
1 files changed, 61 insertions, 60 deletions
diff --git a/gnu/packages/simulation.scm b/gnu/packages/simulation.scm index 00bf74d0f0a..e558bc2d2ce 100644 --- a/gnu/packages/simulation.scm +++ b/gnu/packages/simulation.scm | |||
| @@ -902,22 +902,21 @@ user interface to the FEniCS core components and external libraries.") | |||
| 902 | (define-public fenics | 902 | (define-public fenics |
| 903 | (package/inherit fenics-dolfin | 903 | (package/inherit fenics-dolfin |
| 904 | (name "fenics") | 904 | (name "fenics") |
| 905 | (build-system python-build-system) | 905 | (build-system pyproject-build-system) |
| 906 | (inputs | ||
| 907 | (modify-inputs (package-inputs fenics-dolfin) | ||
| 908 | (delete "python") | ||
| 909 | (prepend pybind11 python-matplotlib))) | ||
| 910 | (native-inputs | ||
| 911 | (modify-inputs (package-native-inputs fenics-dolfin) | ||
| 912 | (prepend cmake-minimal python-ply python-pytest python-decorator))) | ||
| 913 | (propagated-inputs | ||
| 914 | (list fenics-dolfin | ||
| 915 | python-petsc4py | ||
| 916 | python-slepc4py | ||
| 917 | ;; 'dolfin/jit/jit.py' parses 'dolfin.pc' at runtime. | ||
| 918 | python-pkgconfig)) | ||
| 919 | (arguments | 906 | (arguments |
| 920 | (list | 907 | (list |
| 908 | #:test-flags | ||
| 909 | #~(list | ||
| 910 | "unit" | ||
| 911 | ;; This test fails and is ignored. | ||
| 912 | "--deselect" | ||
| 913 | "unit/nls/test_PETScSNES_solver.py::test_snes_set_from_options" | ||
| 914 | ;; These tests are flaky. | ||
| 915 | "--deselect=unit/common/test_timer.py::test_context_manager_named" | ||
| 916 | "--deselect=unit/common/test_timer.py::test_context_manager_anonymous" | ||
| 917 | ;; FIXME: Tests with binary encoded hdf5 files fail with a | ||
| 918 | ;; segfault. See fenics-project DOLFIN commit 6fbc9fb. | ||
| 919 | "--ignore=unit/io/test_XDMF.py") | ||
| 921 | #:phases | 920 | #:phases |
| 922 | #~(modify-phases %standard-phases | 921 | #~(modify-phases %standard-phases |
| 923 | (add-after 'unpack 'relax-requirements | 922 | (add-after 'unpack 'relax-requirements |
| @@ -929,7 +928,7 @@ user interface to the FEniCS core components and external libraries.") | |||
| 929 | ;; Instead of cluttering the user's PKG_CONFIG_PATH environment | 928 | ;; Instead of cluttering the user's PKG_CONFIG_PATH environment |
| 930 | ;; variable, hard-code the 'dolfin.pc' absolute file name. | 929 | ;; variable, hard-code the 'dolfin.pc' absolute file name. |
| 931 | (let ((pc-file (search-input-file inputs | 930 | (let ((pc-file (search-input-file inputs |
| 932 | "/lib/pkgconfig/dolfin.pc"))) | 931 | "/lib/pkgconfig/dolfin.pc"))) |
| 933 | (substitute* "python/dolfin/jit/jit.py" | 932 | (substitute* "python/dolfin/jit/jit.py" |
| 934 | (("pkgconfig\\.parse\\(\"dolfin\"\\)") | 933 | (("pkgconfig\\.parse\\(\"dolfin\"\\)") |
| 935 | (string-append "pkgconfig.parse(\"" pc-file "\")")))))) | 934 | (string-append "pkgconfig.parse(\"" pc-file "\")")))))) |
| @@ -939,8 +938,7 @@ user interface to the FEniCS core components and external libraries.") | |||
| 939 | (setenv "PYBIND11_DIR" #$(this-package-input "pybind11")) | 938 | (setenv "PYBIND11_DIR" #$(this-package-input "pybind11")) |
| 940 | ;; Move to python sub-directory. | 939 | ;; Move to python sub-directory. |
| 941 | (chdir "python"))) | 940 | (chdir "python"))) |
| 942 | (add-after 'build 'mpi-setup | 941 | (add-after 'build 'mpi-setup #$%openmpi-setup) |
| 943 | #$%openmpi-setup) | ||
| 944 | (add-before 'check 'pre-check | 942 | (add-before 'check 'pre-check |
| 945 | (lambda _ | 943 | (lambda _ |
| 946 | ;; Exclude three tests that generate 'NotImplementedError' in | 944 | ;; Exclude three tests that generate 'NotImplementedError' in |
| @@ -949,34 +947,32 @@ user interface to the FEniCS core components and external libraries.") | |||
| 949 | ;; Also exclude tests that require meshes supplied by git-lfs. | 947 | ;; Also exclude tests that require meshes supplied by git-lfs. |
| 950 | (substitute* "demo/test.py" | 948 | (substitute* "demo/test.py" |
| 951 | (("(.*stem !.*)" line) | 949 | (("(.*stem !.*)" line) |
| 952 | (string-append line | 950 | (format #f "~a |
| 953 | "\n" | 951 | excludeList = [~{ '~a',~% ~}] |
| 954 | "excludeList = [\n" | 952 | demos = [d for d in demos if d[0].stem not in excludeList]~%" |
| 955 | "'built-in-meshes', \n" | 953 | line |
| 956 | "'hyperelasticity', \n" | 954 | (list "built-in-meshes" |
| 957 | "'elasticity', \n" | 955 | "hyperelasticity" |
| 958 | "'multimesh-quadrature', \n" | 956 | "elasticity" |
| 959 | "'multimesh-marking', \n" | 957 | "multimesh-quadrature" |
| 960 | "'mixed-poisson-sphere', \n" | 958 | "multimesh-marking" |
| 961 | "'mesh-quality', \n" | 959 | "mixed-poisson-sphere" |
| 962 | "'lift-drag', \n" | 960 | "mesh-quality" |
| 963 | "'elastodynamics', \n" | 961 | "lift-drag" |
| 964 | "'dg-advection-diffusion', \n" | 962 | "elastodynamics" |
| 965 | "'curl-curl', \n" | 963 | "dg-advection-diffusion" |
| 966 | "'contact-vi-tao', \n" | 964 | "curl-curl" |
| 967 | "'contact-vi-snes', \n" | 965 | "contact-vi-tao" |
| 968 | "'collision-detection', \n" | 966 | "contact-vi-snes" |
| 969 | "'buckling-tao', \n" | 967 | "collision-detection" |
| 970 | "'auto-adaptive-navier-stokes', \n" | 968 | "buckling-tao" |
| 971 | "'advection-diffusion', \n" | 969 | "auto-adaptive-navier-stokes" |
| 972 | "'subdomains', \n" | 970 | "advection-diffusion" |
| 973 | "'stokes-taylor-hood', \n" | 971 | "subdomains" |
| 974 | "'stokes-mini', \n" | 972 | "stokes-taylor-hood" |
| 975 | "'navier-stokes', \n" | 973 | "stokes-mini" |
| 976 | "'eigenvalue']\n" | 974 | "navier-stokes" |
| 977 | "demos = [" | 975 | "eigenvalue")))) |
| 978 | "d for d in demos if d[0].stem not " | ||
| 979 | "in excludeList]\n"))) | ||
| 980 | ;; Do not test for expired numpy aliases. | 976 | ;; Do not test for expired numpy aliases. |
| 981 | (substitute* "test/unit/la/test_vector.py" | 977 | (substitute* "test/unit/la/test_vector.py" |
| 982 | ((" numpy.float\\(42.0\\),") "") | 978 | ((" numpy.float\\(42.0\\),") "") |
| @@ -988,32 +984,37 @@ user interface to the FEniCS core components and external libraries.") | |||
| 988 | ;; Restrict OpenBLAS to MPI-only in preference to MPI+OpenMP. | 984 | ;; Restrict OpenBLAS to MPI-only in preference to MPI+OpenMP. |
| 989 | (setenv "OPENBLAS_NUM_THREADS" "1"))) | 985 | (setenv "OPENBLAS_NUM_THREADS" "1"))) |
| 990 | (replace 'check | 986 | (replace 'check |
| 991 | (lambda* (#:key tests? #:allow-other-keys) | 987 | (lambda* (#:key tests? test-flags #:allow-other-keys) |
| 992 | (when tests? | 988 | (when tests? |
| 993 | (with-directory-excursion "test" | 989 | (with-directory-excursion "test" |
| 994 | (invoke "pytest" | 990 | (apply invoke "pytest" test-flags))))) |
| 995 | "unit" | ||
| 996 | ;; This test fails and is ignored. | ||
| 997 | "--deselect" | ||
| 998 | "unit/nls/test_PETScSNES_solver.py::test_snes_set_from_options" | ||
| 999 | ;; FIXME: Tests with binary encoded hdf5 files fail with a | ||
| 1000 | ;; segfault. See fenics-project DOLFIN commit 6fbc9fb. | ||
| 1001 | "--ignore" | ||
| 1002 | "unit/io/test_XDMF.py"))))) | ||
| 1003 | (add-after 'install 'install-demo-files | 991 | (add-after 'install 'install-demo-files |
| 1004 | (lambda* (#:key outputs #:allow-other-keys) | 992 | (lambda _ |
| 1005 | (let* ((demos (string-append (assoc-ref outputs "out") | 993 | (let* ((demos (string-append #$output |
| 1006 | "/share/python-dolfin/demo"))) | 994 | "/share/python-dolfin/demo"))) |
| 1007 | (mkdir-p demos) | 995 | (mkdir-p demos) |
| 1008 | (with-directory-excursion "demo" | 996 | (with-directory-excursion "demo" |
| 1009 | (for-each (lambda (file) | 997 | (for-each (lambda (file) |
| 1010 | (let* ((dir (dirname file)) | 998 | (let* ((dir (dirname file)) |
| 1011 | (tgt-dir (string-append demos | 999 | (tgt-dir (string-append demos "/" dir))) |
| 1012 | "/" dir))) | ||
| 1013 | (unless (equal? "." dir) | 1000 | (unless (equal? "." dir) |
| 1014 | (mkdir-p tgt-dir) | 1001 | (mkdir-p tgt-dir) |
| 1015 | (install-file file tgt-dir)))) | 1002 | (install-file file tgt-dir)))) |
| 1016 | (find-files "." ".*\\.(py|gz|xdmf)$"))))))))) | 1003 | (find-files "." ".*\\.(py|gz|xdmf)$"))))))))) |
| 1004 | (inputs | ||
| 1005 | (modify-inputs (package-inputs fenics-dolfin) | ||
| 1006 | (delete "python") | ||
| 1007 | (prepend pybind11 python-matplotlib))) | ||
| 1008 | (native-inputs | ||
| 1009 | (modify-inputs (package-native-inputs fenics-dolfin) | ||
| 1010 | (prepend cmake-minimal python-ply python-pytest python-decorator | ||
| 1011 | python-setuptools))) | ||
| 1012 | (propagated-inputs | ||
| 1013 | (list fenics-dolfin | ||
| 1014 | python-petsc4py | ||
| 1015 | python-slepc4py | ||
| 1016 | ;; 'dolfin/jit/jit.py' parses 'dolfin.pc' at runtime. | ||
| 1017 | python-pkgconfig)) | ||
| 1017 | (home-page "https://fenicsproject.org/") | 1018 | (home-page "https://fenicsproject.org/") |
| 1018 | (synopsis "High-level environment for solving differential equations") | 1019 | (synopsis "High-level environment for solving differential equations") |
| 1019 | (description | 1020 | (description |
