%global pypi_name pymatreader Name: python-%{pypi_name} Version: 1.3.1 Release: 1%{?dist} Summary: Convenient reader for Matlab mat files # SPDX -- pyproject.toml declares BSD-2-Clause. License: BSD-2-Clause URL: https://gitlab.com/obob/pymatreader Source0: %{pypi_source %{pypi_name}} BuildArch: noarch BuildRequires: python3-devel BuildRequires: pyproject-rpm-macros # %%check runs the upstream suite. BuildRequires: %{py3_dist pytest} %global _description %{expand: pymatreader reads Matlab .mat files of any version, including the HDF5-based v7.3 format, and returns plain Python dictionaries of numpy arrays -- no MATLAB installation and no mat_struct objects to unpack. It is packaged here because Fedora retired it: python-pymatreader was orphaned for six weeks and removed from rawhide, so it exists in f44 and nowhere later. Upstream is healthy -- 1.3.1 was released 2026-09-02 -- and python-mne needs it to read EEGLAB .set files, which is not an optional corner of MEG/EEG work.} %description %{_description} %package -n python3-%{pypi_name} Summary: %{summary} %description -n python3-%{pypi_name} %{_description} %prep %autosetup -n %{pypi_name}-%{version} # Upstream resolves its version with the hatch-regex-commit plugin, which is not # packaged in Fedora and would have to be packaged solely to read a string that # is already sitting in the sdist twice -- pymatreader/_version.py says # __version__ = '1.3.1' and PKG-INFO agrees. Pin it statically instead and drop # the plugin from the build requirements. sed -i -e 's/^dynamic = \["version"\]$/version = "%{version}"/' pyproject.toml sed -i -e 's/^requires = \["hatchling", "hatch-regex-commit"\]$/requires = ["hatchling"]/' pyproject.toml python3 - <<'EOF' import re, sys s = open('pyproject.toml').read() s = re.sub(r'\[tool\.hatch\.version\]\n(?:[^\[]*\n)?', '', s, count=1) open('pyproject.toml','w').write(s) EOF # NB: written as if-statements, not `grep -q X && { exit 1; }`. %prep runs under # sh -e, and a bare `grep && ...` whose grep finds nothing returns 1, which would # fail the build precisely when the check passes. if ! grep -q '^version = "%{version}"' pyproject.toml; then echo "ERROR: static version not applied" >&2; exit 1 fi if grep -q 'hatch-regex-commit' pyproject.toml; then echo "ERROR: hatch-regex-commit still referenced" >&2; exit 1 fi if grep -q 'tool.hatch.version' pyproject.toml; then echo "ERROR: dynamic version source still present" >&2; exit 1 fi %generate_buildrequires %pyproject_buildrequires %build %pyproject_wheel %install %pyproject_install %pyproject_save_files -l %{pypi_name} %check %pyproject_check_import # The suite reads real .mat fixtures, so it exercises both the scipy path (v4-v7) # and the h5py path (v7.3) rather than just importing. %pytest %files -n python3-%{pypi_name} -f %{pyproject_files} %doc README.md CHANGELOG.md %changelog * Wed Sep 23 2026 Morgan Hough - 1.3.1-1 - Initial packaging, adopting a Fedora orphan. python-pymatreader was orphaned for 6+ weeks and retired from rawhide, so it survives only in f44; f45 and rawhide have nothing. That makes python-mne 1.13.2-3 unbuildable there on both arches, since it BuildRequires python3-pymatreader for the EEGLAB tests. - Upstream is not the problem: 1.3.1 is three weeks old, BSD-2-Clause, pure Python, and its four dependencies (h5py, numpy, scipy, xmltodict) are all in Fedora. Fedora lost the maintainer, not the software. - Version pinned statically in %%prep so the build does not need hatch-regex-commit, which Fedora does not package.