## START: Set by rpmautospec
## (rpmautospec version 0.7.3)
## 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

%bcond tests 1

# Do not build docs, bundle JS etc.
# Point to upstream docs instead

%global desc %{expand: \
Brian2 is a simulator for spiking neural networks available on almost all
platforms. The motivation for this project is that a simulator should not only
save the time of processors, but also the time of scientists.

It is the successor of Brian1 and shares its approach of being highly flexible
and easily extensible. It is based on a code generation framework that allows
to execute simulations using other programming languages and/or on different
devices.

Please report issues to the github issue tracker
(https://github.com/brian-team/brian2/issues) or to the brian support mailing
list (http://groups.google.com/group/briansupport/)

Documentation for Brian2 can be found at http://brian2.readthedocs.org}

%global forgeurl https://github.com/brian-team/brian2

Name:           python-brian2
Version:        2.8.0
Release:        %autorelease
Summary:        A clock-driven simulator for spiking neural networks

%global tag %{version}

%forgemeta


License:        CECILL-2.0
URL:            https://briansimulator.org
Source0:        %forgesource

# Drop i686
# https://fedoraproject.org/wiki/Changes/EncourageI686LeafRemoval
ExcludeArch:    %{ix86}

BuildRequires:  gcc-c++ gcc
BuildRequires:  gsl-devel

%description
%{desc}

%package -n python3-brian2
Summary:        %{summary}
BuildRequires:  python3-devel
BuildRequires:  python3-setuptools
BuildRequires:  python3-setuptools_scm

Suggests:       %{py3_dist ipython}
%py_provides python3-brian2

%description -n python3-brian2
%{desc}

%package doc
Summary:    %{summary}
BuildArch:  noarch

%description doc
Documentation and examples for %{name}.


%prep
%forgeautosetup

# remove pre-compiled standalone binary example---the scripts there regenerate it
rm -rf examples/multiprocessing/standalone307987

sed -i -e 's/"numpy>=2.*",/"numpy",/' \
    pyproject.toml


# Remove unnecessary files
find . -name ".gitignore" -print -delete
rm -rvf Brian2.egg-info
rm -f brian2/synapses/cythonspikequeue.cpp

# Correct shebang for examples
find examples -name "*.py" -print -exec sed -i 's|^#!/usr/bin/env python|#!/usr/bin/python3|' '{}' \;

%generate_buildrequires
export SETUPTOOLS_SCM_PRETEND_VERSION=%{version}
%pyproject_buildrequires -r %{?with_tests:-x test}


%build
export SETUPTOOLS_SCM_PRETEND_VERSION=%{version}
%pyproject_wheel

%install
export SETUPTOOLS_SCM_PRETEND_VERSION=%{version}
%pyproject_install
%pyproject_save_files -l "brian2*"

%check
%pyproject_check_import -e brian2.hears -t

%if %{with tests}
export PYTHONDONTWRITEBYTECODE=1
# https://github.com/brian-team/brian2/blob/master/dev/continuous-integration/run_test_suite.py
# https://brian2.readthedocs.io/en/stable/developer/guidelines/testing.html
# prevent direct import
pushd ../
PYTHONPATH=$RPM_BUILD_ROOT/%{python3_sitearch}/ %{python3} -c 'import brian2; brian2.test(test_openmp=True, test_GSL=True, test_codegen_independent=True, test_in_parallel=["codegen_independent", "numpy", "cpp_standalone"])'
popd
%endif

# remove pytest_cache
rm -rf $RPM_BUILD_ROOT/%{python3_sitearch}/brian2/{tests,}/.pytest_cache/

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

%files doc
%license LICENSE
%doc examples

%changelog
## START: Generated by rpmautospec
* Fri Dec 20 2024 Packit <hello@packit.dev> - 2.8.0-1
- Update to 2.8.0 upstream release
- Resolves: rhbz#2333487

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

* Fri Jul 05 2024 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 2.7.1-1
- feat: update to 2.7.1 (fixes rh#2269724)

* Wed Jul 03 2024 Packit <hello@packit.dev> - 2.6.0-1
- [packit] 2.6.0 upstream release
- Resolves rhbz#2269724

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

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

* Sun Jan 21 2024 Fedora Release Engineering <releng@fedoraproject.org> - 2.5.4-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Tue Jan 02 2024 Benjamin A. Beasley <code@musicinmybrain.net> - 2.5.4-3
- Assert that the .dist-info directory contains a license file

* Mon Nov 06 2023 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 2.5.4-1
- feat: update to 2.5.4 (fixes rh#2216804)

* Sun Nov 05 2023 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 2.5.1-5
- chore: add packit

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

* Fri Jun 30 2023 Python Maint <python-maint@redhat.com> - 2.5.1-3
- Rebuilt for Python 3.12

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

* Thu Jan 12 2023 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 2.5.1-1
- feat: update to 2.5.1 (fixes rhbz#2100481)

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

* Tue Jul 19 2022 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 2.5.0.3-4
- Rebuilt for pyparsing-3.0.9

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

* Wed Mar 02 2022 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 2.5.0.3-2
- chore: update pytest cache removal command for pytest 7 (fixes
  #rhbz2059948)

* Sat Feb 19 2022 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 2.5.0.3-1
- feat: update to 2.5.0.3 (fixes rhbz#2038870)

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

* Tue Jan 04 2022 Ankur Sinha (Ankur Sinha Gmail) <sanjay.ankur@gmail.com> - 2.5.0.1-1
- feat: update to 2.5.0.1

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

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

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

* Sat Nov 28 2020 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 2.4.2-1
- Update to 2.4.2

* Tue Sep 29 2020 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 2.4.1-1
- Update to 2.4.1

* Fri Sep 04 2020 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 2.4-1
- Update to 2.4

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

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

* Tue Apr 07 2020 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 2.3.0.2-1
- Update to latest release

* Sat Apr 04 2020 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 2.3.0.1-1
- Update to latest upstream release

* Sat Feb 01 2020 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 2.3-1
- Update to latest release

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

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

* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 2.2.2.1-3
- Rebuilt for Python 3.8

* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.2.2.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild

* Wed Apr 10 2019 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 2.2.2.1-1
- Update to latest upstream release
- Remove AUTHORS, tutorials that are no longer included in tar

* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.2-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

* Sat Nov 10 2018 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 2.2-1
- Initial build

## END: Generated by rpmautospec