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

Name:           python-pyspike
Version:        0.8.0
Release:        %autorelease
Summary:        Library for the numerical analysis of spike train similarity

License:        BSD-2-Clause
URL:            https://github.com/mariomulansky/PySpike
Source:         %{url}/archive/%{version}/PySpike-%{version}.tar.gz

# Adapt numpy_include proxy for Cython 3 by making it an os.PathLike
# https://github.com/mariomulansky/PySpike/pull/75
# See also:
# https://github.com/mariomulansky/PySpike/pull/68
Patch:          %{url}/pull/75.patch
# Exclude tests from packages
# https://github.com/mariomulansky/PySpike/pull/76
Patch:          %{url}/pull/76.patch
# In setup.cfg, replace deprecated metadata.description-file
# https://github.com/mariomulansky/PySpike/pull/77
Patch:          %{url}/pull/77.patch

BuildRequires:  python3-devel
BuildRequires:  %{py3_dist Cython}
BuildRequires:  gcc

# Test dependencies are documented in Readme.rst:
BuildRequires:  %{py3_dist pytest}
BuildRequires:  %{py3_dist scipy}

%global _description %{expand:
PySpike is a Python library for the numerical analysis of spike train
similarity. Its core functionality is the implementation of the ISI-distance[1]
and SPIKE-distance[2], SPIKE-Synchronization [3], as well as their adaptive
generalizations[4]. It provides functions to compute multivariate profiles,
distance matrices, as well as averaging and general spike train processing. All
computation intensive parts are implemented in C via Cython to reach a
competitive performance (factor 100-200 over plain Python).

PySpike provides the same fundamental functionality as the SPIKY framework for
Matlab, which additionally contains spike-train generators, more spike train
distance measures and many visualization routines.

If you use PySpike in your research, please cite our SoftwareX publication on
PySpike:

Mario Mulansky, Thomas Kreuz, *PySpike - A Python library for analyzing spike
train synchrony*, Software X 5, 183 (2016)

Additionally, depending on the used methods: ISI-distance [1], SPIKE-distance
[2], SPIKE-Synchronization [3], or their adaptive generalizations [4], please
cite one or more of the following publications:

[1] Kreuz T, Haas JS, Morelli A, Abarbanel HDI, Politi A, Measuring spike train
synchrony. J Neurosci Methods 165, 151 (2007)

[2] Kreuz T, Chicharro D, Houghton C, Andrzejak RG, Mormann F, Monitoring spike
train synchrony. J Neurophysiol 109, 1457 (2013)

[3] Kreuz T, Mulansky M and Bozanic N, *SPIKY: A graphical user interface for
monitoring spike train synchrony*, J Neurophysiol 113, 3432 (2015)

[4] Satuvuori E, Mulansky M, Bozanic N, Malvestio I, Zeldenrust F, Lenk K, and
Kreuz T, Measures of spike train synchrony for data with multiple time-scales,
J Neurosci Methods 287, 25 (2017)

Documentation is available at http://mariomulansky.github.io/PySpike/}

%description %_description

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

%description -n python3-pyspike %_description

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

# Remove Cythonized C sources
# https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_using_cython
find . -type f -exec grep -FrinIl 'Generated by Cython' '{}' '+' |
  xargs -r -t rm -v

# Comment out to remove /usr/bin/env shebangs
# Can use something similar to correct/remove /usr/bin/python shebangs also
# find . -type f -name "*.py" -exec sed -i '/^#![  ]*\/usr\/bin\/env.*$/ d' {} 2>/dev/null ';'

%generate_buildrequires
%pyproject_buildrequires

%build
%pyproject_wheel

%install
%pyproject_install
%pyproject_save_files pyspike

%check
%pytest -v

%files -n python3-pyspike -f %{pyproject_files}
%license License.txt
%doc Readme.rst
%doc Changelog
%doc Contributors.txt
%doc examples/

%changelog
## START: Generated by rpmautospec
* Sun Feb 25 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 0.8.0-1
- Update to 0.8.0 (close RHBZ#2222843)
- Update License to SPDX
- Run the tests
- Support Cython 3 (fix RHBZ#2254038)
- Package examples as documentation

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

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

* Wed Sep 06 2023 Sandro <devel@penguinpee.nl> - 0.7.0-9
- Use Cython < 3~~ (RHBZ#2226301)
- Add documentation

* Tue Aug 15 2023 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 0.7.0-8
- chore: add packit

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

* Tue Jun 13 2023 Python Maint <python-maint@redhat.com> - 0.7.0-6
- Rebuilt for Python 3.12

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

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

* Mon Jun 13 2022 Python Maint <python-maint@redhat.com> - 0.7.0-3
- Rebuilt for Python 3.11

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

* Sun Jan 16 2022 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 0.7.0-1
- feat: update to 0.7.0
- move to pyproject macros
- drop doc subpackage (requires unbundling of js etc.)

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

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

* Wed Apr 14 2021 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 0.6.0-1
- Include examples in doc sub package
- Build and include docs

* Sun Apr 11 2021 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 0.6.0-1
- Initial build

## END: Generated by rpmautospec