da73980
# https://fedoraproject.org/wiki/Packaging:DistTag?rd=Packaging/DistTag#Conditionals
da73980
%if 0%{?fedora} >= 30
da73980
%bcond_with py2
da73980
%else
da73980
%bcond_without py2
da73980
%endif
da73980
da73980
%bcond_with tests
da73980
da73980
%global srcname brian2
da73980
%global pretty_name Brian2
da73980
da73980
# Documents disabled for the moment
da73980
%bcond_with docs
da73980
da73980
%global desc %{expand: \
da73980
Brian2 is a simulator for spiking neural networks available on almost all
da73980
platforms. The motivation for this project is that a simulator should not only
da73980
save the time of processors, but also the time of scientists.
da73980
da73980
It is the successor of Brian1 and shares its approach of being highly flexible
da73980
and easily extensible. It is based on a code generation framework that allows
da73980
to execute simulations using other programming languages and/or on different
da73980
devices.
da73980
da73980
Please report issues to the github issue tracker
da73980
(https://github.com/brian-team/brian2/issues) or to the brian support mailing
da73980
list (http://groups.google.com/group/briansupport/)
da73980
da73980
Documentation for Brian2 can be found at http://brian2.readthedocs.org}
da73980
da73980
Name:           python-%{srcname}
466bea1
Version:        2.2.2.1
466bea1
Release:        1%{?dist}
da73980
Summary:        A clock-driven simulator for spiking neural networks
da73980
da73980
da73980
License:        CeCILL
da73980
URL:            https://pypi.python.org/pypi/%{pretty_name}
da73980
Source0:        %pypi_source %{pretty_name}
da73980
Patch0:         0001-Brian2-2.2-remove-crosscompiling.patch
da73980
da73980
BuildRequires:  gcc-c++ gcc
da73980
BuildRequires:  gsl-devel
da73980
da73980
%description
da73980
%{desc}
da73980
da73980
%if %{with py2}
da73980
%package -n python2-%{srcname}
da73980
Summary:        %{summary}
da73980
BuildRequires:  python2-devel
da73980
BuildRequires:  %{py2_dist Cython} >= 0.18
da73980
BuildRequires:  %{py2_dist setuptools}
da73980
BuildRequires:  %{py2_dist nose}
da73980
BuildRequires:  %{py2_dist numpy} >= 1.10
da73980
BuildRequires:  %{py2_dist sympy} >= 0.7.6
da73980
BuildRequires:  %{py2_dist pyparsing}
da73980
BuildRequires:  %{py2_dist jinja2}
da73980
BuildRequires:  %{py2_dist py-cpuinfo}
da73980
da73980
# For code generation
da73980
Requires:       %{py2_dist Cython} >= 0.18
da73980
Requires:       %{py2_dist numpy} >= 1.10
da73980
Requires:       %{py2_dist sympy} >= 0.7.6
da73980
Requires:       %{py2_dist pyparsing}
da73980
Requires:       %{py2_dist jinja2}
da73980
Requires:       %{py2_dist py-cpuinfo}
da73980
da73980
Suggests:       %{py2_dist ipython}
da73980
%{?python_provide:%python_provide python2-%{srcname}}
da73980
da73980
%description -n python2-%{srcname}
da73980
%{desc}
da73980
%endif
da73980
da73980
%package -n python3-%{srcname}
da73980
Summary:        %{summary}
da73980
BuildRequires:  python3-devel
da73980
BuildRequires:  %{py3_dist Cython} >= 0.18
da73980
BuildRequires:  %{py3_dist setuptools}
da73980
BuildRequires:  %{py3_dist nose}
da73980
%if %{with docs}
da73980
BuildRequires:  %{py3_dist sphinx}
da73980
%endif
da73980
BuildRequires:  %{py3_dist numpy} >= 1.10
da73980
BuildRequires:  %{py3_dist sympy} >= 0.7.6
da73980
BuildRequires:  %{py3_dist pyparsing}
da73980
BuildRequires:  %{py3_dist jinja2}
da73980
BuildRequires:  %{py3_dist py-cpuinfo}
da73980
da73980
# For code generation
da73980
Requires:       %{py3_dist Cython} >= 0.18
da73980
Requires:       %{py3_dist numpy} >= 1.10
da73980
Requires:       %{py3_dist sympy} >= 0.7.6
da73980
Requires:       %{py3_dist pyparsing}
da73980
Requires:       %{py3_dist jinja2}
da73980
Requires:       %{py3_dist py-cpuinfo}
da73980
da73980
Suggests:       %{py3_dist ipython}
da73980
%{?python_provide:%python_provide python3-%{srcname}}
da73980
da73980
%description -n python3-%{srcname}
da73980
%{desc}
da73980
da73980
%package doc
da73980
Summary:    %{summary}
da73980
BuildArch:  noarch
da73980
da73980
%description doc
da73980
Documentation and examples for %{name}.
da73980
da73980
da73980
%prep
da73980
# We must create a different directory because otherwise the Cython bits etc
da73980
# seem to cause trouble when building both py2 and py3. This is because the
da73980
# codebase is still py2, and 2to3 is run during the build to convert it to py3.
da73980
# So, we must keep the two versions completely separate
da73980
%autosetup -n %{pretty_name}-%{version} -c -N
da73980
da73980
pushd %{pretty_name}-%{version}
da73980
    # Remove unnecessary files
da73980
    find . -name ".gitignore" -print -delete
da73980
    rm -rvf %{pretty_name}.egg-info
da73980
    rm -f brian2/synapses/cythonspikequeue.cpp
da73980
    %autopatch -p0
da73980
    # Remove this since it is only an issue on Windows systems
da73980
    sed -i 's|, !=4.0.0||' setup.py
da73980
da73980
    # Correct shebang for examples
da73980
    find examples -name "*.py" -print -exec sed -i 's|^#!/usr/bin/env python|#!/usr/bin/python3|' '{}' \;
da73980
popd
da73980
da73980
cp -r %{pretty_name}-%{version} %{pretty_name}-%{version}-py2
da73980
da73980
da73980
%build
da73980
pushd %{pretty_name}-%{version}
da73980
    %py3_build
da73980
    %if %{with docs}
da73980
    # Build documentation
da73980
    PYTHONPATH=.
da73980
    sphinx-build-3 docs_sphinx html
da73980
    %endif
da73980
popd
da73980
da73980
%if %{with py2}
da73980
pushd %{pretty_name}-%{version}-py2
da73980
    %py2_build
da73980
popd
da73980
%endif
da73980
da73980
da73980
%install
da73980
%if %{with py2}
da73980
pushd %{pretty_name}-%{version}-py2
da73980
    %py2_install
da73980
popd
da73980
%endif
da73980
da73980
pushd %{pretty_name}-%{version}
da73980
    %py3_install
da73980
popd
da73980
da73980
%check
da73980
%if %{with tests}
da73980
# We cannot use the local build because the codebase is still py2 and uses 2to3
da73980
# to convert to py3 during the build process and install the converted bits, so
da73980
# we *must* point to the installed version for tests
da73980
# https://github.com/brian-team/brian2/issues/1027
da73980
export PYTHONDONTWRITEBYTECODE=1
da73980
%if %{with py2}
da73980
pushd %{pretty_name}-%{version}-py2
da73980
    # remove since we dont want it to use this version
da73980
    rm -rf %{srcname}
da73980
    PYTHONPATH=$RPM_BUILD_ROOT/%{python2_sitearch}/ %{__python2} -c 'import brian2; brian2.test()'
da73980
popd
da73980
%endif
da73980
da73980
pushd %{pretty_name}-%{version}
da73980
    # remove since we dont want it to use this version
da73980
    rm -rf %{srcname}
da73980
    PYTHONPATH=$RPM_BUILD_ROOT/%{python3_sitearch}/ %{__python3} -c 'import brian2; brian2.test()'
da73980
popd
da73980
%endif
da73980
da73980
%if %{with py2}
da73980
%files -n python2-%{srcname}
da73980
%license %{pretty_name}-%{version}/LICENSE
466bea1
%doc %{pretty_name}-%{version}/README.rst
da73980
%{python2_sitearch}/%{srcname}
da73980
%{python2_sitearch}/%{pretty_name}-%{version}-py2.?.egg-info
da73980
%endif
da73980
da73980
%files -n python3-%{srcname}
da73980
%license %{pretty_name}-%{version}/LICENSE
da73980
%{python3_sitearch}/%{srcname}
da73980
%{python3_sitearch}/%{pretty_name}-%{version}-py3.?.egg-info
466bea1
%doc %{pretty_name}-%{version}/README.rst
da73980
da73980
%files doc
da73980
%license %{pretty_name}-%{version}/LICENSE
466bea1
%doc %{pretty_name}-%{version}/examples
da73980
%if %{with docs}
da73980
%doc %{pretty_name}-%{version}/html
da73980
%endif
da73980
da73980
%changelog
466bea1
* Wed Apr 10 2019 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 2.2.2.1-1
466bea1
- Update to latest upstream release
466bea1
- Remove AUTHORS, tutorials that are no longer included in tar
466bea1
e4d910b
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.2-2
e4d910b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
e4d910b
da73980
* Sat Nov 10 2018 Ankur Sinha <ankursinha AT fedoraproject DOT org> - 2.2-1
da73980
- Initial build