## START: Set by rpmautospec
## (rpmautospec version 0.6.0)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 5;
    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

# Use forge macros for pulling from GitHub
%global forgeurl https://github.com/alexandrebarachant/pyRiemann

Name:           python-pyriemann
Version:        0.5
Release:        %autorelease
Summary:        Riemannian Geometry for Python
%forgemeta
License:        BSD-3-Clause
URL:            %forgeurl
Source0:        %forgesource
# For fixing test failures
# https://github.com/pyRiemann/pyRiemann/issues/262
Patch:          https://patch-diff.githubusercontent.com/raw/pyRiemann/pyRiemann/pull/254.patch

# This package has had architecture-dependent test failures in the past, e.g.
# “One test failure on s390x”
# https://github.com/pyRiemann/pyRiemann/issues/192, so we make the base
# package arched to ensure the tests run on all architectures. The binary
# packages are all still noarch, and there is no compiled code and therefore no
# debugging symbols.
%global debug_package %{nil}

# Since F40, python-scikit-learn is ExcludeArch: %%{ix86}
ExcludeArch:    %{ix86}

BuildRequires:  python3-devel

# Required to run tests
BuildRequires:  python3dist(pytest)

# Weak dependencies required for various tests
BuildRequires:  python3dist(seaborn)
BuildRequires:  python3dist(matplotlib)

%global common_description %{expand:
pyRiemann is a Python package for covariance matrices manipulation and
classification through Riemannian geometry.

The primary target is classification of multivariate biosignals, like EEG, MEG
or EMG.}

%description %{common_description}


%package -n python3-pyriemann
Summary:        %{summary}

BuildArch:      noarch

# Weak dependencies (not covered by extras other than “docs”/“tests”).
# See docs/installing.rst “Recommended dependencies”.
Recommends:     python3dist(matplotlib)
Recommends:     python3dist(mne)
Recommends:     python3dist(seaborn)

%description -n python3-pyriemann %{common_description}


%package doc
Summary:        Documentation and examples for pyRiemann

BuildArch:      noarch

# Sphinx-generated HTML documentation is not suitable for packaging; see
# https://bugzilla.redhat.com/show_bug.cgi?id=2006555 for discussion.
#
# In general, we can generate PDF documentation as a substitute.
#
# Unfortunately, we can’t build *this* documentation without the MNE sample
# data (https://osf.io/86qa2). The documentation build tries to download it
# from the network; we could perhaps circumvent this and include it as an
# additional source, but we must not do so because the sample data does not
# appear to be provided under a clearly-stated or acceptable license; see
# https://predictablynoisy.com/mne-python/manual/sample_dataset.html.

%description doc %{common_description}

This package contains documentation and examples for pyRiemann.


%prep
%autosetup -n pyRiemann-%{version} -p1

# Remove copybutton.js script bundled from python.org documentation via
# scikit-learn’s Sphinx theme. We will not be building HTML documentation
# anyway.
rm -vf doc/_static/copybutton.js
sed -r -i 's/^([[:blank:]]*)(.*copybutton\.js)/\1# \2/' doc/conf.py
# Remove bundled copy of https://pypi.org/pyroject/sphinx-issues/; again, we
# are not going to use it.
rm -rvf doc/sphinxext/
sed -r -i 's/^([[:blank:]]*)(.*sphinx_issues.,)/\1# \2/' doc/conf.py
# Patch flake8 out of “tests” extra:
# https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_linters
sed -r -i 's/("tests".*), "flake8"/\1/' setup.py


%generate_buildrequires
%pyproject_buildrequires -x tests


%build
%pyproject_wheel


%install
%pyproject_install
%pyproject_save_files -l pyriemann


%check
%pytest ${k:+-k "$k"}


%files -n python3-pyriemann -f %{pyproject_files}


%files doc
%license LICENSE
%doc README.md
%doc examples


%changelog
## START: Generated by rpmautospec
* Wed Apr 10 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 0.5-5
- F40+: Drop i686 support since python-scikit-learn did

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

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

* Thu Jan 04 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 0.5-2
- Assert that the .dist-info directory contains a license file

* Wed Sep 06 2023 Sandro <devel@penguinpee.nl> - 0.5-1
- Update to 0.5 (RHBZ#2216180)
- Apply patch to fix failing tests
- Remove arch conditional in %%check (PR from @ankursinha)
- Use forge macros
- Close RHBZ#2226298

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

* Tue Jul 04 2023 Python Maint <python-maint@redhat.com> - 0.4-3
- Rebuilt for Python 3.12

* Thu Jun 08 2023 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 0.4-2
- fix: skip test that fails on a few arches

* Mon May 01 2023 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 0.4-1
- feat: update to 0.4 (fixes rhbz#2170052)

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

* Wed Aug 03 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 0.3-3
- Fix test failure on s390x by loosening a tolerance

* Wed Aug 03 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 0.3-2
- Make base package arched
- This runs the tests on all arches, helping flush out arch-dependent
  failures

* Wed Aug 03 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 0.3-1
- Update to 0.3

* Wed Aug 03 2022 Benjamin A. Beasley <code@musicinmybrain.net> - 0.2.7-5
- Port to pyproject-rpm-macros
- Remove bundled copybutton.js script in %%prep
- Split docs and examples into a new subpackage
- Note that we cannot build Sphinx-generated documentation
- Switch License to SPDX (BSD becomes BSD-3-Clause)

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

* Mon Jul 04 2022 Python Maint <python-maint@redhat.com> - 0.2.7-3
- Rebuilt for Python 3.11

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

* Mon Aug 23 2021 Benjamin A. Beasley <code@musicinmybrain.net> - 0.2.7-1
- Update to 0.2.7
- Drop obsolete %%python_provide macro
- Stop manually listing runtime Requires
- Macro-ize repeated description
- Re-write BR’s in python3dist(…) style

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

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

* Thu May 20 2021 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 0.2.6-7.20210520gitcdb6160
- User forge macros
- Use snapshot
- Use pytest, include additional BRs

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

* Wed Sep 09 2020 Aniket Pradhan <major AT fedoraproject DOT org> - 0.2.6-5
- Rebuilt for fixed python-joblib package

* Sat Aug 01 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.6-4
- Second attempt - Rebuilt for
  https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild

* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.6-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild

* Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 0.2.6-2
- Rebuilt for Python 3.9

* Tue Apr 21 2020 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 0.2.6-1
- Update to 0.2.6

* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.4-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild

* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 0.2.4-9
- Rebuilt for Python 3.8

* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.4-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild

* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.4-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

* Thu Oct 11 2018 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 0.2.4-6
- Python2 binary package has been removed
  See https://fedoraproject.org/wiki/Changes/Mass_Python_2_Package_Removal

* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.4-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 0.2.4-4
- Rebuilt for Python 3.7

* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.4-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.4-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Sat Mar 11 2017 Igor Gnatenko <ignatenko@redhat.com> - 0.2.4-1
- Update to 0.2.4

* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.3-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 0.2.3-7
- Rebuild for Python 3.6

* Mon Sep 26 2016 Dominik Mierzejewski <rpm@greysector.net> - 0.2.3-6
- rebuilt for matplotlib-2.0.0

* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2.3-5
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.3-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Sun Nov 29 2015 Igor Gnatenko <i.gnatenko.brain@gmail.com> - 0.2.3-3
- Fix building with new scikit-learn
- Fix requirements a bit

* Thu Nov 12 2015 Igor Gnatenko <i.gnatenko.brain@gmail.com> - 0.2.3-2
- Fix pandas requirements on f23

* Wed Nov 11 2015 Igor Gnatenko <i.gnatenko.brain@gmail.com> - 0.2.3-1
- Initial package

## END: Generated by rpmautospec