%global pypi_name emsutil # The LICENSE file was added upstream (same author) after 0.8.3 was tagged. %global license_commit 5f1da68 Name: python-%{pypi_name} # EMerge 2.8.x requires emsutil >= 0.8.3, < 0.9; Hertzon pins EMerge 2.8.9. Version: 0.8.3 Release: 1%{?dist} Summary: Common utilities for the EMerge electromagnetic simulator License: MIT URL: https://github.com/FennisRobert/emsutil Source0: %{url}/archive/v%{version}/%{pypi_name}-%{version}.tar.gz Source1: https://raw.githubusercontent.com/FennisRobert/emsutil/%{license_commit}/LICENSE BuildArch: noarch BuildRequires: python3-devel BuildRequires: pyproject-rpm-macros %global _description %{expand: emsutil holds the pieces shared by Robert Fennis' EMerge FEM solver and its companion tools: physical constants, the frequency- and coordinate-dependent Material class and material libraries (Rogers, Isola), msgpack-based saving of simulation objects, field and far-field data structures and the matplotlib and PyVista plotting helpers.} %description %_description %package -n python3-%{pypi_name} Summary: %{summary} %description -n python3-%{pypi_name} %_description %prep %autosetup -n %{pypi_name}-%{version} cp -p %{SOURCE1} LICENSE # numpy < 2.3 is an upstream pin, not a known incompatibility; Fedora ships 2.3-2.5. sed -i 's/"numpy>=1.24, <2.3"/"numpy>=1.24"/' pyproject.toml %generate_buildrequires %pyproject_buildrequires %build %pyproject_wheel %install %pyproject_install %pyproject_save_files %{pypi_name} %check %pyproject_check_import # No upstream tests at this tag. Exercise the parts EMerge relies on: # constants, materials and the msgpack save/load round trip with arrays. cd %{_builddir} %{py3_test_envvars} MPLBACKEND=Agg %{python3} - <<'PYEOF' import os, tempfile import numpy as np import emsutil from emsutil import C0, EPS0, MU0, Material, save_object, load_object assert abs(C0 - 299792458) < 1, C0 assert abs(1 / np.sqrt(EPS0 * MU0) - C0) / C0 < 1e-6 m = Material(er=4.4, tand=0.02, name="FR4") f = os.path.join(tempfile.mkdtemp(), "obj.emd") a = np.linspace(0, 1, 7).reshape(7, 1) * (1 + 2j) save_object(f, {"freq": a, "label": "x", "n": 3}) d = load_object(f) assert np.allclose(d["freq"], a) and d["freq"].dtype == a.dtype assert d["label"] == "x" and d["n"] == 3 print("emsutil ok") PYEOF %files -n python3-%{pypi_name} -f %{pyproject_files} %license LICENSE %doc README.md %changelog * Wed Oct 21 2026 Morgan Hough - 0.8.3-1 - Initial package (EMerge dependency, for Hertzon).