From da73980c8c6c9e7e5a81aebd30eea4b05c5da4aa Mon Sep 17 00:00:00 2001 From: Ankur Sinha (Ankur Sinha Gmail) Date: Nov 14 2018 22:22:51 +0000 Subject: Initial import --- diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..902947f --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/Brian2-2.2.tar.gz diff --git a/0001-Brian2-2.2-remove-crosscompiling.patch b/0001-Brian2-2.2-remove-crosscompiling.patch new file mode 100644 index 0000000..514cefb --- /dev/null +++ b/0001-Brian2-2.2-remove-crosscompiling.patch @@ -0,0 +1,28 @@ +--- setup.py.orig 2018-11-12 13:51:13.633177938 +0000 ++++ setup.py 2018-11-12 13:51:52.183489600 +0000 +@@ -67,22 +67,9 @@ + fname = cpp_fname + + if fname is not None: +- if (platform.system() == 'Linux' and +- platform.architecture()[0] == '32bit' and +- platform.machine() == 'x86_64'): +- # We are cross-compiling (most likely to build a 32Bit package for conda +- # on travis), set paths and flags for 32Bit explicitly +- print('Configuring compilation for cross-compilation to 32 Bit') +- extensions = [Extension("brian2.synapses.cythonspikequeue", +- [fname], +- include_dirs=[], # numpy include dir will be added later +- library_dirs=['/lib32', '/usr/lib32'], +- extra_compile_args=['-m32'], +- extra_link_args=['-m32'])] +- else: +- extensions = [Extension("brian2.synapses.cythonspikequeue", +- [fname], +- include_dirs=[])] # numpy include dir will be added later ++ extensions = [Extension("brian2.synapses.cythonspikequeue", ++ [fname], ++ include_dirs=[])] # numpy include dir will be added later + if fname == pyx_fname: + extensions = cythonize(extensions) + else: diff --git a/python-brian2.spec b/python-brian2.spec new file mode 100644 index 0000000..3bd1498 --- /dev/null +++ b/python-brian2.spec @@ -0,0 +1,210 @@ +# https://fedoraproject.org/wiki/Packaging:DistTag?rd=Packaging/DistTag#Conditionals +%if 0%{?fedora} >= 30 +%bcond_with py2 +%else +%bcond_without py2 +%endif + +%bcond_with tests + +%global srcname brian2 +%global pretty_name Brian2 + +# Documents disabled for the moment +%bcond_with docs + +%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} + +Name: python-%{srcname} +Version: 2.2 +Release: 1%{?dist} +Summary: A clock-driven simulator for spiking neural networks + + +License: CeCILL +URL: https://pypi.python.org/pypi/%{pretty_name} +Source0: %pypi_source %{pretty_name} +Patch0: 0001-Brian2-2.2-remove-crosscompiling.patch + +BuildRequires: gcc-c++ gcc +BuildRequires: gsl-devel + +%description +%{desc} + +%if %{with py2} +%package -n python2-%{srcname} +Summary: %{summary} +BuildRequires: python2-devel +BuildRequires: %{py2_dist Cython} >= 0.18 +BuildRequires: %{py2_dist setuptools} +BuildRequires: %{py2_dist nose} +BuildRequires: %{py2_dist numpy} >= 1.10 +BuildRequires: %{py2_dist sympy} >= 0.7.6 +BuildRequires: %{py2_dist pyparsing} +BuildRequires: %{py2_dist jinja2} +BuildRequires: %{py2_dist py-cpuinfo} + +# For code generation +Requires: %{py2_dist Cython} >= 0.18 +Requires: %{py2_dist numpy} >= 1.10 +Requires: %{py2_dist sympy} >= 0.7.6 +Requires: %{py2_dist pyparsing} +Requires: %{py2_dist jinja2} +Requires: %{py2_dist py-cpuinfo} + +Suggests: %{py2_dist ipython} +%{?python_provide:%python_provide python2-%{srcname}} + +%description -n python2-%{srcname} +%{desc} +%endif + +%package -n python3-%{srcname} +Summary: %{summary} +BuildRequires: python3-devel +BuildRequires: %{py3_dist Cython} >= 0.18 +BuildRequires: %{py3_dist setuptools} +BuildRequires: %{py3_dist nose} +%if %{with docs} +BuildRequires: %{py3_dist sphinx} +%endif +BuildRequires: %{py3_dist numpy} >= 1.10 +BuildRequires: %{py3_dist sympy} >= 0.7.6 +BuildRequires: %{py3_dist pyparsing} +BuildRequires: %{py3_dist jinja2} +BuildRequires: %{py3_dist py-cpuinfo} + +# For code generation +Requires: %{py3_dist Cython} >= 0.18 +Requires: %{py3_dist numpy} >= 1.10 +Requires: %{py3_dist sympy} >= 0.7.6 +Requires: %{py3_dist pyparsing} +Requires: %{py3_dist jinja2} +Requires: %{py3_dist py-cpuinfo} + +Suggests: %{py3_dist ipython} +%{?python_provide:%python_provide python3-%{srcname}} + +%description -n python3-%{srcname} +%{desc} + +%package doc +Summary: %{summary} +BuildArch: noarch + +%description doc +Documentation and examples for %{name}. + + +%prep +# We must create a different directory because otherwise the Cython bits etc +# seem to cause trouble when building both py2 and py3. This is because the +# codebase is still py2, and 2to3 is run during the build to convert it to py3. +# So, we must keep the two versions completely separate +%autosetup -n %{pretty_name}-%{version} -c -N + +pushd %{pretty_name}-%{version} + # Remove unnecessary files + find . -name ".gitignore" -print -delete + rm -rvf %{pretty_name}.egg-info + rm -f brian2/synapses/cythonspikequeue.cpp + %autopatch -p0 + # Remove this since it is only an issue on Windows systems + sed -i 's|, !=4.0.0||' setup.py + + # Correct shebang for examples + find examples -name "*.py" -print -exec sed -i 's|^#!/usr/bin/env python|#!/usr/bin/python3|' '{}' \; +popd + +cp -r %{pretty_name}-%{version} %{pretty_name}-%{version}-py2 + + +%build +pushd %{pretty_name}-%{version} + %py3_build + %if %{with docs} + # Build documentation + PYTHONPATH=. + sphinx-build-3 docs_sphinx html + %endif +popd + +%if %{with py2} +pushd %{pretty_name}-%{version}-py2 + %py2_build +popd +%endif + + +%install +%if %{with py2} +pushd %{pretty_name}-%{version}-py2 + %py2_install +popd +%endif + +pushd %{pretty_name}-%{version} + %py3_install +popd + +%check +%if %{with tests} +# We cannot use the local build because the codebase is still py2 and uses 2to3 +# to convert to py3 during the build process and install the converted bits, so +# we *must* point to the installed version for tests +# https://github.com/brian-team/brian2/issues/1027 +export PYTHONDONTWRITEBYTECODE=1 +%if %{with py2} +pushd %{pretty_name}-%{version}-py2 + # remove since we dont want it to use this version + rm -rf %{srcname} + PYTHONPATH=$RPM_BUILD_ROOT/%{python2_sitearch}/ %{__python2} -c 'import brian2; brian2.test()' +popd +%endif + +pushd %{pretty_name}-%{version} + # remove since we dont want it to use this version + rm -rf %{srcname} + PYTHONPATH=$RPM_BUILD_ROOT/%{python3_sitearch}/ %{__python3} -c 'import brian2; brian2.test()' +popd +%endif + +%if %{with py2} +%files -n python2-%{srcname} +%license %{pretty_name}-%{version}/LICENSE +%doc %{pretty_name}-%{version}/README.rst %{pretty_name}-%{version}/AUTHORS +%{python2_sitearch}/%{srcname} +%{python2_sitearch}/%{pretty_name}-%{version}-py2.?.egg-info +%endif + +%files -n python3-%{srcname} +%license %{pretty_name}-%{version}/LICENSE +%{python3_sitearch}/%{srcname} +%{python3_sitearch}/%{pretty_name}-%{version}-py3.?.egg-info +%doc %{pretty_name}-%{version}/README.rst %{pretty_name}-%{version}/AUTHORS + +%files doc +%license %{pretty_name}-%{version}/LICENSE +%doc %{pretty_name}-%{version}/examples %{pretty_name}-%{version}/tutorials +%if %{with docs} +%doc %{pretty_name}-%{version}/html +%endif + +%changelog +* Sat Nov 10 2018 Ankur Sinha - 2.2-1 +- Initial build diff --git a/sources b/sources new file mode 100644 index 0000000..5dbbf89 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (Brian2-2.2.tar.gz) = be0dcb92450020e50ac2885e165766215a59cbb3bcfdcc74cf45dc4d0eca159f5d2a5bfe7132af8c65e4980c2f66d8242389eccd127faa59bcd8cc19983a0edb