From 92499d0d5deb0724817afb17d749a77e90a2ce3d Mon Sep 17 00:00:00 2001
From: Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com>
Date: Mar 16 2022 11:05:02 +0000
Subject: [PATCH 1/2] feat: add spec


---

diff --git a/python-ephyviewer.spec b/python-ephyviewer.spec
new file mode 100644
index 0000000..dfafe9b
--- /dev/null
+++ b/python-ephyviewer.spec
@@ -0,0 +1,63 @@
+Name:           python-ephyviewer
+Version:        1.5.1
+Release:        %autorelease
+Summary:        Simple viewers for ephys signals, events, video and more
+
+License:        MIT
+URL:            https://github.com/NeuralEnsemble/ephyviewer
+Source0:        %{url}/archive/%{version}/%{name}-%{version}.tar.gz
+
+BuildArch:      noarch
+BuildRequires:  python3-devel
+BuildRequires:  python3-pytest
+
+
+BuildRequires: python3-matplotlib
+BuildRequires: python3-numpy
+BuildRequires: python3-scipy
+BuildRequires: python3-abi
+BuildRequires: python3-pyqtgraph
+
+%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.}
+
+%description %_description
+
+%package -n python3-ephyviewer
+Summary:        %{summary}
+
+%description -n python3-ephyviewer %_description
+
+
+%prep
+%autosetup -n ephyviewer-%{version}
+
+
+%generate_buildrequires
+%pyproject_buildrequires -r
+
+
+%build
+%pyproject_wheel
+
+
+%install
+%pyproject_install
+%pyproject_save_files ephyviewer
+
+%check
+%if %{with tests}
+
+%pytest\
+
+	--deselect tests/test_dataframeview.py\
+	--deselect tests/test_standalone.py\
+	--deselect tests/test_traceviewer.py\
+%endif
+
+%files -n python3-ephyviewer -f %{pyproject_files}
+%doc README.*
+
+
+%changelog
+%autochangelog

From 3f0359ba74575a45e66ef12c4598ab3bef309598 Mon Sep 17 00:00:00 2001
From: Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com>
Date: Mar 16 2022 14:02:04 +0000
Subject: [PATCH 2/2] feat: update spec to fix build


---

diff --git a/python-ephyviewer.spec b/python-ephyviewer.spec
index dfafe9b..023c776 100644
--- a/python-ephyviewer.spec
+++ b/python-ephyviewer.spec
@@ -1,3 +1,5 @@
+%bcond_without tests
+
 Name:           python-ephyviewer
 Version:        1.5.1
 Release:        %autorelease
@@ -12,19 +14,21 @@ BuildRequires:  python3-devel
 BuildRequires:  python3-pytest
 
 
-BuildRequires: python3-matplotlib
-BuildRequires: python3-numpy
-BuildRequires: python3-scipy
-BuildRequires: python3-abi
-BuildRequires: python3-pyqtgraph
-
 %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.}
+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}
+# needs Xvfb
+BuildRequires:  xorg-x11-server-Xvfb
 
 %description -n python3-ephyviewer %_description
 
@@ -32,9 +36,15 @@ Summary:        %{summary}
 %prep
 %autosetup -n ephyviewer-%{version}
 
+# 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
+sed -i -e '/spikeinterface/ d' -e '/av/ d' -e '/pytest-cov/ d' requirements-tests.txt
+
 
 %generate_buildrequires
-%pyproject_buildrequires -r
+%pyproject_buildrequires -r -x tests
 
 
 %build
@@ -48,15 +58,15 @@ Summary:        %{summary}
 %check
 %if %{with tests}
 
-%pytest\
-
-	--deselect tests/test_dataframeview.py\
-	--deselect tests/test_standalone.py\
-	--deselect tests/test_traceviewer.py\
+# some tests segfault with xvfb, so we disable these
+# other tests that require unpackaged extra modules or download data
+xvfb-run -a -s "-screen 0 1920x1200x24 -ac +extension GLX" pytest-3 \
+    -k "not test_spiketrainviewer and not test_timefreqviewer and not test_traceviewer and not test_VideoMultiFileSource and not test_spikeinterface_sources and not test_spikeinterface_viewer and not test_videoviewer and not test_neo_rawio_sources and not test_mainviewer2 and not test_neoviewer"
 %endif
 
 %files -n python3-ephyviewer -f %{pyproject_files}
 %doc README.*
+%{_bindir}/ephyviewer
 
 
 %changelog

