Blob Blame History Raw
# Require mpi for tests, and seem to hang in Mock, so disabled by default
%bcond_with tests

%global _description %{expand: \
SpyKING CIRCUS is a python code to allow fast spike sorting on multi channel
recordings. A publication on the algorithm can be found at

It has been tested on datasets coming from in vitro retina with 252 electrodes
MEA, from in vivo hippocampus with tetrodes, in vivo and in vitro cortex data
with 30 and up to 4225 channels, with good results. Synthetic tests on these
data show that cells firing at more than 0.5Hz can be detected, and their
spikes recovered with error rates at around 1%, even resolving overlapping
spikes and synchronous firing. It seems to be compatible with optogenetic
stimulation, based on experimental data obtained in the retina.}

%global forgeurl

Name:           python-spyking-circus
Version:        1.1.0
Release:        %autorelease
Summary:        Fast and scalable spike sorting of large-scale extracellular recordings

%global tag  %{version}

License:        CeCILL
URL:            %forgeurl
Source0:        %forgesource

# We install the probe files to datadir
Patch0:         set-probe-datadir.patch
BuildArch:      noarch

%description %_description

%package -n python3-spyking-circus
Summary:        %{summary}
BuildRequires:  python3-devel
BuildRequires:  /usr/bin/patch
%if %{with tests}
BuildRequires:  mpich-devel
BuildRequires:  python3-mpi4py-mpich
BuildRequires:  openmpi-devel
BuildRequires:  python3-mpi4py-openmpi
BuildRequires:  python3-pytest

%description -n python3-spyking-circus %_description

%package -n python3-spyking-circus-common
Summary:        Common files for %{name}

%description -n python3-spyking-circus-common %_description

# MPICH meta package
%package -n python3-spyking-circus-mpich
Summary:        Meta package for %{name}
Requires:       python3-mpi4py-mpich
Requires:       python3-spyking-circus%{?_isa} = %{version}-%{release}

%description -n python3-spyking-circus-mpich %_description

# OpenMPI meta package
%package -n python3-spyking-circus-openmpi
Summary:        Meta package for %{name}
Requires:       python3-mpi4py-openmpi
Requires:       python3-spyking-circus%{?_isa} = %{version}-%{release}

%description -n python3-spyking-circus-openmpi %_description

%forgeautosetup -S patch

# Set the path to datadir
sed -i "s|SED_ME|%{_datadir}/spyking-circus/|"

# remove mpi4py from requires, we add it manually
sed -i "s/'mpi4py', //"

# Remove env
find . -type f -name "*.py" -exec sed -i '/^#![  ]*\/usr\/bin\/env.*$/ d' {} 2>/dev/null ';'

# Remove nose from tests: we use pytest
sed -i 's/nose,//' tests/



# remove duplicate installed files
mkdir -m 0755 -p $RPM_BUILD_ROOT/%{_datadir}/spyking-circus/
mv $RPM_BUILD_ROOT/%{python3_sitelib}/usr/share/spyking-circus/* $RPM_BUILD_ROOT/%{_datadir}/spyking-circus/
rm -rf $RPM_BUILD_ROOT/%{python3_sitelib}/usr/

%pyproject_save_files -l circus

%if %{with tests}
%{pytest} tests/

%{pytest} tests/

%files -n python3-spyking-circus -f %{pyproject_files}
%doc README.rst