%global py2ver %(%{__python2} -c "import sys ; print sys.version[:3]")
%global py2_incdir %{_includedir}/python%{py2ver}
%global py3ver %(%{__python3} -c "import sys ; print (sys.version[:3])")
%global py3_incdir %{_includedir}/python%{py3ver}m

%global srcname pygsl
%global sum GNU Scientific Library Interface for python

Name:          pygsl
Version:       2.2.0
Release:       4%{?dist}
Summary:       %{sum}

# The package is mostly GPL+ but there are two scripts
# GLPv2+: pygsl/odeiv.py and examples/siman_tsp.py
License:       GPLv2+
Url:           http://pygsl.sourceforge.net
Source0:       http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
BuildRequires: gsl-devel
BuildRequires: python2-devel
BuildRequires: python2-numpy
BuildRequires: numpy
BuildRequires: python2-numpy-f2py
BuildRequires: numpy-f2py

BuildRequires: python3-devel
BuildRequires: python3-numpy
BuildRequires: python3-numpy-f2py

Requires:      python-%{srcname} = %{version}-%{release}

# Only need if the generated sources are different from the version used in source
# BuildRequires: swig

%description
This project provides a python interface for the GNU scientific library (gsl)


%package -n python2-%{srcname}
Summary:       %{sum}
#Requires:      python2-numpy
Requires:      numpy
%{?python_provide:%python_provide python2-%{srcname}}

%description -n python2-%{srcname}
This project provides a python interface for the GNU scientific library (gsl)


%package -n python3-%{srcname}
Summary:       %{sum}
Requires:      python3-numpy
%{?python_provide:%python_provide python3-%{srcname}}

%description -n python3-%{srcname}
This project provides a python interface for the GNU scientific library (gsl)


%package devel
Summary:       Development files for pygsl
Requires:      python-%{srcname}-devel = %{version}-%{release}

%description devel
Development files for pygsl


%package -n python2-%{srcname}-devel
Summary:       Development files for pygsl
Requires:      python2-%{srcname} = %{version}-%{release}
Requires:      python2-devel
%{?python_provide:%python_provide python2-%{srcname}-devel}

%description -n python2-%{srcname}-devel
Development files for pygsl


%package -n python3-%{srcname}-devel
Summary:       Development files for pygsl
Requires:      python3-%{srcname} = %{version}-%{release}
Requires:      python3-devel
%{?python_provide:%python_provide python3-%{srcname}-devel}

%description -n python3-%{srcname}-devel
Development files for pygsl


%prep
%setup

%build
# Only need if the generated sources are different from the version used in source
# rm -f swig_src/gslwrap_wrap.c
%__python2 setup.py config
%py2_build
%__python3 setup.py config
%py3_build

%install
%py2_install
%py3_install

%files

%files devel

%files -n python2-%{srcname}
%license COPYING
%doc ChangeLog README CREDITS
%doc examples/  doc/index.html doc/README.html doc/TODO.html
%{python2_sitearch}/*

%files -n python2-%{srcname}-devel
%{py2_incdir}/%{srcname}
%doc testing tests

%files -n python3-%{srcname}
%license COPYING
%doc ChangeLog README CREDITS
%doc examples/  doc/index.html doc/README.html doc/TODO.html
%{python3_sitearch}/*

%files -n python3-%{srcname}-devel
%{py3_incdir}/%{srcname}
%doc testing tests

%changelog
* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.2.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 2.2.0-3
- Rebuild for Python 3.6

* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.2.0-2
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Tue Apr  19 2016 José Matos <jamatos@fedoraproject.org> - 2.2.0-1
- update to 2.2.0

* Sat Mar  5 2016 José Matos <jamatos@fedoraproject.org> - 2.1.1-4
- rebuild for gsl 2.1
- Use swig to regenerate the wrappers.

* Mon Feb 22 2016 Orion Poplawski <orion@cora.nwra.com> - 2.1.1-3
- Rebuild for gsl 2.1

* Sun Feb 14 2016 José Matos <jamatos@fedoraproject.org> - 2.1.1-2
- fix requirements (typos)

* Sat Feb 13 2016 José Matos <jamatos@fedoraproject.org> - 2.1.1-1
- update to 2.1.1
- remove included license
- add python2 and python3 subpackages, preserving the upgrade path

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.5-14
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.5-13
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.5-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.5-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.5-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.5-9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild

* Mon Nov 26 2012 José Matos <jamatos@fedoraproject.org> - 0.9.5-8
- Clean spec file (thanks to Jussi #528515)

* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.5-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Sat Jan 14 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.5-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Mon May  9 2011 José Matos <jamatos@fedoraproject.org> - 0.9.5-5
- Rebuild for a newer gsl (F16+)

* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.5-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Wed Jul 21 2010 David Malcolm <dmalcolm@redhat.com> - 0.9.5-3
- Rebuilt for https://fedoraproject.org/wiki/Features/Python_2.7/MassRebuild

* Mon May 10 2010 José Matos <jamatos@fc.up.pt> - 0.9.5-2
- Rebuild for new gsl version (F14+).

* Thu Apr  8 2010 José Matos <jamatos@fc.up.pt> - 0.9.5-1
- Bug fix release. A memory leak was fixed for all modules using
  gsl_functions: integrate, min, roots, deriv.
- Include more original documentation.
- Remove patch applied upstream.

* Thu Nov 19 2009 José Matos <jamatos@fc.up.pt> - 0.9.4-7
- Revert to local patch as upstream one does not work.

* Thu Nov 19 2009 José Matos <jamatos@fc.up.pt> - 0.9.4-6
- Request build with the upstream patch.

* Thu Nov 19 2009 José Matos <jamatos@fc.up.pt> - 0.9.4-5
- Fix typo in -devel Summary. (#504881)

* Tue Sep 15 2009 José Matos <jamatos@fc.up.pt> - 0.9.4-4
- Remove gsm units taken away in gsl-1.13.

* Tue Sep 15 2009 José Matos <jamatos@fc.up.pt> - 0.9.4-3
- Rebuild for new upstream gsl version (F12+).

* Thu Jul 30 2009 José Matos <jamatos[AT]fc.up.pt> - 0.9.4-2
- Add missing BR numpy-f2py

* Thu Jul 30 2009 José Matos <jamatos[AT]fc.up.pt> - 0.9.4-1
- New upstream bugfix release

* Sun Jul 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.3-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Thu Feb 26 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.3-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

* Wed Jan 21 2009 José Matos <jamatos@fc.up.pt> - 0.9.3-3
- Rebuild for new gsl (F11+).

* Sat Nov 29 2008 Ignacio Vazquez-Abrams <ivazqueznet+rpm@gmail.com> - 0.9.3-2
- Rebuild for Python 2.6

* Tue Jun 17 2008 José Matos <jamatos[AT]fc.up.pt> - 0.9.3-1
- New upstream release.

* Fri Feb 22 2008 José Matos <jamatos[AT]fc.up.pt> - 0.9.1-8
- Add egg-info file to package (F9+).

* Tue Feb 19 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 0.9.1-7
- Autorebuild for GCC 4.3

* Fri Sep 21 2007 José Matos <jamatos[AT]fc.up.pt> - 0.9.1-6
- License clarification.
- Use swig to regenerate the wrappers.
- Rebuild with gsl-1.10.
- Add explicit dependency on gsl version.

* Thu Aug 30 2007 José Matos <jamatos[AT]fc.up.pt> - 0.9.1-5
- Fix typo in Requires for subpackage devel.

* Wed Aug 29 2007 José Matos <jamatos[AT]fc.up.pt> - 0.9.1-4
- Remove docs from documentation as it not carried anymore, add a devel subpackage.

* Wed Aug 29 2007 José Matos <jamatos[AT]fc.up.pt> - 0.9.1-3
- Corrected the reference to numpy.

* Wed Aug 29 2007 José Matos <jamatos[AT]fc.up.pt> - 0.9.1-2
- Rebuild with the correct source.

* Wed Aug 29 2007 José Matos <jamatos[AT]fc.up.pt> - 0.9.1-1
- New upstream version.
- Change from numeric to numpy.

* Wed Aug 29 2007 José Matos <jamatos[AT]fc.up.pt> - 0.3.2-8
- License fix, rebuild for devel (F8).

* Mon Dec 11 2006 José Matos <jamatos[AT]fc.up.pt> - 0.3.2-7
- Rebuild for python 2.5.

* Mon Sep 11 2006 José Matos <jamatos[AT]fc.up.pt> - 0.3.2-6
- Rebuild for FC6.

* Thu Feb 16 2006 José Matos <jamatos[AT]fc.up.pt> - 0.3.2-5
- Rebuild for FC-5.

* Sat Jul  2 2005 José Matos <jamatos[AT]fc.up.pt> - 0.3.2-4
- Add license file from cvs.

* Fri Jul  1 2005 José Matos <jamatos[AT]fc.up.pt> - 0.3.2-3
- Remove duplicated "setup" entry.

* Fri Jul  1 2005 José Matos <jamatos[AT]fc.up.pt> - 0.3.2-2
- Clean spec file.

* Thu Jun 30 2005 José Matos <jamatos[AT]fc.up.pt> - 0.3.2-1
- New version.