%global srcname dolfinx-external-operator %global pypi_name dolfinx-external-operator Name: python-%{pypi_name} Version: 0.11.0 Release: 1%{?dist} Summary: ufl.ExternalOperator for DOLFINx: operators defined by external code License: LGPL-3.0-or-later URL: https://github.com/a-latyshev/dolfinx-external-operator Source: %{url}/archive/v%{version}/%{srcname}-%{version}.tar.gz BuildArch: noarch # python3-dolfinx-openmpi keeps its dist-info under %%{python3_sitearch}/openmpi # (Fedora MPI guidelines), so nothing provides python3dist(fenics-dolfinx); the # generated requirement could never be met. The explicit python3-dolfinx-openmpi # Requires below carry the same 0.11 range. %global __requires_exclude python3[.0-9]*dist\\(fenics-dolfinx\\) BuildRequires: python3-devel BuildRequires: python3-pytest # %%check: upstream test/ runs real DOLFINx assembly (forms are JIT-compiled # with ffcx and gcc) under the openmpi flavour BuildRequires: openmpi-devel BuildRequires: gcc BuildRequires: python3-dolfinx-openmpi >= 0.11.0 BuildRequires: python3-petsc-openmpi BuildRequires: python3-mpi4py-openmpi %global _description %{expand: dolfinx-external-operator implements UFL's ExternalOperator for DOLFINx: a term in a variational form whose values (and derivatives) are computed by user code rather than by UFL. The code can be plain NumPy, Numba, JAX or PyTorch; with JAX or PyTorch the derivatives needed for Newton's method can come from automatic differentiation. Typical uses are constitutive models in solid mechanics (plasticity, data-driven hyperelasticity) and other pointwise models that are awkward to write in UFL.} %description %_description %package -n python3-%{pypi_name} Summary: %{summary} # DOLFINx is packaged per MPI implementation; openmpi is the one this COPR # builds. Numba, JAX and PyTorch are used only by user code and the demos. Requires: python3-dolfinx-openmpi >= 0.11.0 Requires: python3-dolfinx-openmpi < 0.12 Recommends: python3-numba %description -n python3-%{pypi_name} %_description %prep %autosetup -n %{srcname}-%{version} # A trained PyTorch model used only by demo 06; model weights are never packaged # here, and the demos are not installed. rm -f "doc/demo/Isihara_noise=high.pth" # pyproject points at a LICENSE file that does not exist (the texts are # COPYING and COPYING.LESSER); setuptools would fail to find it. sed -i 's/^license = { file = "LICENSE" }/license = "LGPL-3.0-or-later"/' pyproject.toml # [build-system] names no build-backend, so pyproject-rpm-macros treat it as a # legacy setup.py project (there is no setup.py) and fail; pip would fall back to # setuptools.build_meta, so declare exactly that. sed -i '/^requires = \["setuptools/a build-backend = "setuptools.build_meta"' pyproject.toml %generate_buildrequires # -R: runtime deps are listed explicitly (see __requires_exclude above) %pyproject_buildrequires -R %build %pyproject_wheel %install %pyproject_install %pyproject_save_files dolfinx_external_operator %check %{_openmpi_load} export PYTHONPATH="%{buildroot}%{python3_sitelib}${PYTHONPATH:+:$PYTHONPATH}" export XDG_CACHE_HOME="$PWD/jit-cache" export OMPI_MCA_rmaps_base_oversubscribe=1 export PRTE_MCA_rmaps_default_mapping_policy=:oversubscribe python3 -m pytest -q -p no:cacheprovider test/ mpirun -np 2 python3 -m pytest -q -p no:cacheprovider test/ %{_openmpi_unload} %files -n python3-%{pypi_name} -f %{pyproject_files} %license COPYING COPYING.LESSER %doc README.md %{_bindir}/dolfinx-external-operator %changelog * Sun Oct 25 2026 Morgan Hough - 0.11.0-1 - New package: upstream 0.11.0, the release matching DOLFINx 0.11. %%check runs upstream's test/ serially and on 2 MPI ranks.