## START: Set by rpmautospec
## (rpmautospec version 0.7.3)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 2;
    base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
    print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec

%bcond tests 1

# Sphinx-generated HTML documentation is not suitable for packaging; see
# https://bugzilla.redhat.com/show_bug.cgi?id=2006555 for discussion.
#
# We can generate PDF documentation as a substitute.
%bcond doc_pdf 1

%global pypi_name meautility
%global pretty_name MEAutility

Name:           python-%{pypi_name}
Version:        1.5.2
Release:        %autorelease
Summary:        Package for multi-electrode array (MEA) handling and stimulation

%global forgeurl https://github.com/alejoe91/MEAutility
%global tag %{version}
%forgemeta

License:        GPL-3.0-only
URL:            %forgeurl
Source:         %forgesource
# Upstream switched to pyproject.toml but declared a wrong license (MIT).
# The shipped license is GPL-3.0-only as before.
# https://github.com/alejoe91/MEAutility/pull/47
Patch:          https://github.com/alejoe91/MEAutility/pull/47.patch

BuildArch:      noarch

%global _description %{expand:
Python package for multi-electrode array (MEA) handling and stimulation.
Documentation is available at:
https://meautility.readthedocs.io/}

%description %_description

%package -n python3-%{pypi_name}
Summary:        %{summary}
BuildRequires:  python3-devel

%if %{with tests}
BuildRequires:  %{py3_dist pytest}
%endif

%description -n python3-%{pypi_name} %_description

%package        doc
Summary:        Documentation for %{pretty_name}

%if %{with doc_pdf}
BuildRequires:  make
BuildRequires:  %{py3_dist Sphinx}
BuildRequires:  python3-sphinx-latex
BuildRequires:  latexmk
%endif

%description doc %_description

%prep
%forgeautosetup -p1

%generate_buildrequires
%pyproject_buildrequires

%build
%pyproject_wheel

%if %{with doc_pdf}
PYTHONPATH="${PWD}:${PWD}/MEAutility" \
    %make_build -C docs latex SPHINXOPTS='-j%{?_smp_build_ncpus}'
%make_build -C docs/build/latex LATEXMKOPTS='-quiet'
%endif

%install
%pyproject_install
%pyproject_save_files -l %{pretty_name}

%check
%if %{with tests}
%{pytest}
%endif

%files -n python3-%{pypi_name} -f %{pyproject_files}
%doc README.md

%files doc
%license LICENSE
%doc notebooks
%if %{with doc_pdf}
%doc docs/build/latex/MEAutility.pdf
%endif

%changelog
## START: Generated by rpmautospec
* Thu Mar 27 2025 Sandro <devel@penguinpee.nl> - 1.5.2-1
- Update to 1.5.2 (RHBZ#2337609)
- Use forge macros

* Sat Jan 18 2025 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.1-15
- Rebuilt for https://fedoraproject.org/wiki/Fedora_42_Mass_Rebuild

* Sat Dec 21 2024 Sandro <devel@penguinpee.nl> - 1.5.1-14
- Apply fix for NumPy 2.x

* Mon Jul 29 2024 Miroslav Suchý <msuchy@redhat.com> - 1.5.1-13
- convert GPLv3 license to SPDX

* Fri Jul 19 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.1-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_41_Mass_Rebuild

* Sat Jun 08 2024 Python Maint <python-maint@redhat.com> - 1.5.1-11
- Rebuilt for Python 3.13

* Fri Jan 26 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.1-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Mon Jan 22 2024 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.1-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Wed Jan 03 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 1.5.1-8
- Assert that the .dist-info directory contains a license file

* Fri Jul 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.1-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild

* Tue Jun 27 2023 Python Maint <python-maint@redhat.com> - 1.5.1-5
- Rebuilt for Python 3.12

* Fri Jan 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.1-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild

* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.1-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

* Wed Jun 15 2022 Python Maint <python-maint@redhat.com> - 1.5.1-2
- Rebuilt for Python 3.11

* Fri May 06 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 1.5.1-1
- Update to 1.5.1 (close RHBZ#2082495)

* Fri May 06 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 1.5.0-5
- Drop -r, now the default, from %%%%pyproject_buildrequires

* Fri May 06 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 1.5.0-4
- Reduce LaTeX build verbosity

* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 1.5.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

* Tue Oct 19 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 1.5.0-1
- Upgrade to 1.5.0 (close RHBZ#2012846)
- Switch to pyproject-rpm-macros
- Ensure tests are not packaged
- Build Sphinx-generated PDF documentation and add a -doc subpackage

* Fri Jul 23 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.4.8-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild

* Fri Jun 04 2021 Python Maint <python-maint@redhat.com> - 1.4.8-3
- Rebuilt for Python 3.10

* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.4.8-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

* Fri Nov 27 2020 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 1.4.8-1
- Remove docs: bundle fonts
- Remove unneeded comments
- Use pytest macro

* Thu Nov 26 2020 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 1.4.8-1
- Initial build

## END: Generated by rpmautospec