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

%global forgeurl https://github.com/NeuralEnsemble/ephyviewer

%bcond tests 1

Name:           python-ephyviewer
Version:        1.7.0
Release:        %autorelease
Summary:        Simple viewers for ephys signals, events, video and more
%global tag %{version}
%forgemeta
# SPDX
License:        MIT
URL:            https://ephyviewer.readthedocs.io/
Source:         %forgesource
# Fix compatibility with matplotlib >= 3.9
# https://github.com/NeuralEnsemble/ephyviewer/pull/184
Patch:          %{forgeurl}/pull/185.patch

# Fix for neo 0.13.4
Patch:          %{forgeurl}/pull/188.patch

# python-pyedflib does not support s390x
# https://src.fedoraproject.org/rpms/python-pyedflib/blob/rawhide/f/python-pyedflib.spec
#
# https://fedoraproject.org/wiki/Changes/EncourageI686LeafRemoval
ExcludeArch:    s390x %{ix86}
BuildArch:      noarch
BuildRequires:  python3-devel
%if %{with tests}
BuildRequires:  xwayland-run
%endif

%global _description %{expand:
ephyviewer is a Python library based on pyqtgraph for building custom viewers
for electrophysiological signals, video, events, epochs, spike trains, data
tables, and time-frequency representations of signals. It also provides an
epoch encoder for creating annotations.

Documentation is available at
https://ephyviewer.readthedocs.io/}

%description %_description


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

%description -n python3-ephyviewer %_description


%prep
%forgeautosetup -p1

# spikeinterface and av optional and not yet packaged
# https://pagure.io/neuro-sig/NeuroFedora/issue/473
# av: bindings for ffmpeg so we'll need to see if it can be included in Fedora
# remove pytest-cov and coveralls
sed -i \
  -e '/spikeinterface/ d' \
  -e '/av/ d' \
  -e '/pytest-cov/ d' \
  -e '/coveralls/ d' \
  requirements-tests.txt


%generate_buildrequires
%pyproject_buildrequires -x tests


%build
%pyproject_wheel


%install
%pyproject_install
%pyproject_save_files -l ephyviewer


%check
%if %{with tests}
# These require network access (at least DNS).
k="${k-}${k+ and }not test_neo_rawio_sources"
k="${k-}${k+ and }not test_neoviewer"
# These require python3dist(av), not packaged.
k="${k-}${k+ and }not test_VideoMultiFileSource"
k="${k-}${k+ and }not test_mainviewer2"
k="${k-}${k+ and }not test_videoviewer"
# These require python3dist(spikeinterface), not packaged.
k="${k-}${k+ and }not test_spikeinterface_sources"
k="${k-}${k+ and }not test_spikeinterface_viewer"
%global __pytest xwfb-run -- pytest
%pytest -k "${k-}"
%endif


%files -n python3-ephyviewer -f %{pyproject_files}
%doc README.*
%{_bindir}/ephyviewer


%changelog
## START: Generated by rpmautospec
* Mon Nov 18 2024 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 1.7.0-7
- fix(ftbfs): add patch for neo>0.13.4

* Mon Sep 23 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 1.7.0-6
- Use XWayland to run the graphical tests
- Accurately categorize skipped tests, and re-enable a few.

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

* Wed Jun 26 2024 Python Maint <python-maint@redhat.com> - 1.7.0-3
- Rebuilt for Python 3.13

* Sat May 18 2024 Sandro <devel@penguinpee.nl> - 1.7.0-2
- Fix compatibility with matplotlib >= 3.9

* Sat May 18 2024 Sandro <devel@penguinpee.nl> - 1.7.0-1
- Update to 1.7.0

* Sat May 18 2024 Sandro <devel@penguinpee.nl> - 1.5.1-18
- Assert license is SPDX (no change)

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

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

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

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

* Tue Jul 18 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1.5.1-11
- Rebuild for Python 3.12 (fix RHBZ#2220209)

* Tue Jul 18 2023 Benjamin A. Beasley <code@musicinmybrain.net> - 1.5.1-10
- Drop i686 support (leaf package)

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

* Sun Oct 09 2022 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 1.5.1-8
- feat: exclude s390x

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

* Sun Jun 26 2022 Python Maint <python-maint@redhat.com> - 1.5.1-6
- Rebuilt for Python 3.11

* Thu Apr 21 2022 Vanessa_kris <vanessaigwe1@gmail.com> - 1.5.1-5
- removed srpm from repo

* Tue Mar 29 2022 Vanessa_kris <vanessaigwe1@gmail.com> - 1.5.1-4
- added source file

* Tue Mar 29 2022 Vanessa_kris <vanessaigwe1@gmail.com> - 1.5.1-3
- initial build

* Tue Mar 29 2022 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 1.5.1-2
- feat: update spec to fix build

* Tue Mar 29 2022 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 1.5.1-1
- feat: add spec
## END: Generated by rpmautospec