## START: Set by rpmautospec
## (rpmautospec version 0.6.0)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 4;
    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 desc %{expand: \
LFPy is a Python-module for calculation of extracellular potentials from
multi-compartment neuron models. It relies on the NEURON simulator ( and uses
the Python interface ( it provides.LFPy provides a set of easy-to-use Python
classes for setting up your model, running your simulations and calculating the
extracellular potentials arising from activity in your model neuron. If you
have a model...}

Name:           python-lfpy
Version:        2.3.2
Release:        %autorelease
Summary:        Model extracellular potentials of multicompartment neuron models built on NEURON

License:        GPL-3.0-or-later
URL:            http://lfpy.readthedocs.io
Source0:        %{pypi_source lfpy}

# Requires NEURON, so limited to arches that NEURON and Random123 support
ExcludeArch:    mips64r2 mips32r2
# Upstream does not support powerpc or 32bit arches
# https://github.com/LFPy/LFPy/issues/173
# Bug: ppc: https://bugzilla.redhat.com/show_bug.cgi?id=1838565
# Bug: armv7hl: https://bugzilla.redhat.com/show_bug.cgi?id=1838564
ExcludeArch:    %{power64} %{ix86} armv7hl


BuildRequires:  python3-devel

# setup.py tries to import (from) numpy and Cython. If that fails
# dependency generation also fails. Specifying Cython and numpy as BRs
# explicitly, allows to use %%pyproject_buildrequires to determine all
# other dependencies in %%generate_buildrequires dynamically.
BuildRequires:  python3-Cython
BuildRequires:  python3-numpy

# not included in setup.py
BuildRequires:  python3-mpi4py-openmpi
BuildRequires:  python3-neuron-openmpi
BuildRequires:  python3-mpi4py-mpich
BuildRequires:  python3-neuron-mpich
BuildRequires:  mpich-devel
BuildRequires:  openmpi-devel
BuildRequires:  rpm-mpi-hooks

# Runtime requirement also required for the tests
BuildRequires:  neuron-devel

%description
%{desc}


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

Requires:   python3-mpi4py-openmpi
Requires:   python3-mpi4py-mpich
Requires:   neuron-devel


%description -n python3-lfpy
%{desc}


%prep
%autosetup -n lfpy-%{version}

# Remove shebangs from .py/.pyx files
for lib in $(find . -type f -name "*.py*"); do
 sed '1{\@^#!/usr/bin/env python@d}' $lib > $lib.new &&
 touch -r $lib $lib.new &&
 mv $lib.new $lib
done


%generate_buildrequires
%pyproject_buildrequires -x tests


%build
%pyproject_wheel


%install
%pyproject_install
%pyproject_save_files -l LFPy


%check
# https://github.com/LFPy/LFPy/blob/master/continuous_integration/test_script.sh#L16
%{_mpich_load}
%{pytest} LFPy/test/

%pyproject_check_import -e *x86_64* -e *test*
%{_mpich_unload}

%{_openmpi_load}
%{pytest} LFPy/test/

%pyproject_check_import -e *x86_64* -e *test*
%{_openmpi_unload}

%files -n python3-lfpy -f %{pyproject_files}
%doc README.md

%changelog
## START: Generated by rpmautospec
* Sun Oct 20 2024 Sandro <devel@penguinpee.nl> - 2.3.2-4
- Correct License: field

* Sun Oct 20 2024 Sandro <devel@penguinpee.nl> - 2.3.2-3
- Assert inclusion of license file

* Sun Oct 20 2024 Sandro <devel@penguinpee.nl> - 2.3.2-1
- Update to 2.3.2 (RHBZ#2311335)

* Mon Jul 29 2024 Miroslav Suchý <msuchy@redhat.com> - 2.3-8
- convert GPLv3 license to SPDX

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

* Mon Jun 10 2024 Python Maint <python-maint@redhat.com> - 2.3-6
- Rebuilt for Python 3.13

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

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

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

* Wed Jul 12 2023 Python Maint <python-maint@redhat.com> - 2.3-2
- Rebuilt for Python 3.12

* Tue Feb 14 2023 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 2.3-1
- feat: update to 2.3
- fixes rhbz#2153679
- fixes rhbz#2168138

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

* Mon Nov 28 2022 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 2.2.6-5
- fix: include compiled NEURON files

* Mon Nov 28 2022 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 2.2.6-4
- fix: re-exclude arches, include tests (required for package to import)
- the arches need to be excluded---the tool cannot run without NEURON
- the tests need to be included because importing the top level module
  tries to import them:
  https://github.com/LFPy/LFPy/blob/master/LFPy/__init__.py#L74

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

* Tue Jun 28 2022 Luis Bazan <lbazan@fedoraproject.org> - 2.2.6-2
- remove exclude

* Tue Jun 28 2022 Luis Bazan <lbazan@fedoraproject.org> - 2.2.6-1
- new upstream version

* Fri Jun 17 2022 Python Maint <python-maint@redhat.com> - 2.2.4-2
- Rebuilt for Python 3.11

* Wed Feb 23 2022 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 2.2.4-1
- chore: update version

* Wed Feb 23 2022 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 2.2.2-5
- feat: update to 2.2.4 (fixes rhbz#2026956)

* Wed Feb 23 2022 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 2.2.2-4
- chore: clean up spec

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

* Mon Oct 18 2021 Luis Bazan <lbazan@fedoraproject.org> - 2.2.2-1
- New upstream version

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

* Sun Jun 27 2021 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 2.2.1-3
- Enable tests

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

* Wed Apr 07 2021 Luis Bazan <lbazan@fedoraproject.org> - 2.2.1-1
- New upstream version

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

* Thu Nov 26 2020 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 2.1.2-1
- Update to latest release

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

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

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

* Thu May 21 2020 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 2.0.7-5
- Re-enable tests
- Add arches that we cannot build on
- List bugs for for ExcludeArch

* Thu May 21 2020 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 2.0.7-4
- Update supported architectures

* Wed May 13 2020 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 2.0.7-3
- Cosmetic changes to spec
- Add missing Requires/BR on neuron
- Enable test
- List supported arches
- Remove unneeded test files

* Wed May 13 2020 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 2.0.7-2
- Remove auto-generated mpi4py requires, we use explicitly mention the necessary packages in Requires

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

* Thu Oct 03 2019 Miro Hrončok <mhroncok@redhat.com> - 2.0.3-7
- Rebuilt for Python 3.8.0rc1 (#1748018)

* Sat Aug 31 2019 Luis Bazan <lbazan@fedoraproject.org> - 2.0.3-6
- fix typos in spec

* Mon Aug 26 2019 Luis Bazan <lbazan@fedoraproject.org> - 2.0.3-5
- fix comment #14 BZ #1727491

* Mon Aug 26 2019 Luis Bazan <lbazan@fedoraproject.org> - 2.0.3-4
- fix mixed space and tabs
- non-executable script

* Mon Aug 26 2019 Luis Bazan <lbazan@fedoraproject.org> - 2.0.3-3
- fix some typos and import source

* Thu Aug 22 2019 Miro Hrončok <mhroncok@redhat.com> - 2.0.3-2
- Rebuilt for Python 3.8

* Thu Jun  6 2019 victortyau <victortyau@gmail.com> 2.0.3-1
- Initial package for fedora


## END: Generated by rpmautospec