Blob Blame History Raw
%global giacver 1.5.0.85
%global module  giacpy

%global with_check  1
%global with_python3 1

# Architectures currently not supported
# http://xcas.e.ujf-grenoble.fr/XCAS/viewtopic.php?f=19&t=1723
ExcludeArch: aarch64 %{power64} s390x

Name:           python-%{module}
Version:        0.7.0
Release:        1%{?dist}
Summary:        Python binding for Giac
License:        GPLv2+
URL:            http://webusers.imj-prg.fr/~frederic.han/xcas/giacpy/
Source0:        https://files.pythonhosted.org/packages/source/g/%{module}/%{module}-%{version}.tar.gz
BuildRequires:  giac-devel >= %{giacver}
BuildRequires:  giac-doc   >= %{giacver}
BuildRequires:  gmp-devel, qt5-qtsvg-devel

# math.sin(a) test fails randomly
Patch0:         %{name}-skip_math_sin.patch

%description
A Cython frontend to the c++ library Giac (Computer Algebra System).

# Python2
%if 0%{?with_python2}
%package -n     python2-%{module}
Summary:        Python2 binding for Giac
%{?python_provide:%python_provide python2-%{module}}

BuildRequires:  python2-devel
BuildRequires:  python2-Cython
BuildRequires:  libqcas-devel
Requires:       python2-Cython%{?_isa}
Requires:       giac-doc >= %{giacver}

%description -n python2-%{module}
A Cython frontend to the c++ library Giac (Computer Algebra System).

%package -n     python2-%{module}-devel
Summary:        Development libraries of python2-%{module}
Requires:       python2-%{module}%{?_isa}

%description -n python2-%{module}-devel
Development libraries of Python2 %{module}.
%endif
#

# Python3
%if 0%{?with_python3}
%package -n     python3-%{module}
Summary:        Python3 binding for Giac
%{?python_provide:%python_provide python3-%{module}}

BuildRequires:  python3-devel
BuildRequires:  %{_bindir}/cython
Requires:       python3-Cython%{?_isa}
BuildRequires:  libqcas-devel
Requires:       giac-doc >= %{giacver}

%if 0%{?fedora}
Obsoletes:      python2-%{module} < 0:0.6.8-1
%endif

%description -n python3-%{module}
A Cython frontend to the c++ library Giac (Computer Algebra System).

%package -n     python3-%{module}-devel
Summary:        Development libraries of python3-%{module}
Requires:       python3-%{module}%{?_isa}

%description -n python3-%{module}-devel
Development libraries of Python3 %{module}.
%endif
#

%prep
%autosetup -n %{module}-%{version} -p1

rm -rf *.egg-info

# Remove the cythonized files in order to regenerate them during build.
rm $(grep -rl '/\* Generated by Cython')

%build
%if 0%{?with_python3}
CFLAGS="%{optflags} %(pkg-config --cflags Qt5Xml Qt5Widgets)" %{__python3} setup.py  build --enable-qcas --executable="%{__python3} -s"
%endif

%if 0%{?with_python2}
CFLAGS="%{optflags} %(pkg-config --cflags Qt5Xml Qt5Widgets)" %{__python2} setup.py  build --enable-qcas --executable="%{__python2} -s"
%endif

%install
%if 0%{?with_python3}
%py3_install
rm -f $RPM_BUILD_ROOT%{python3_sitearch}/%{module}/giacpy.cpp
rm -f $RPM_BUILD_ROOT%{python3_sitearch}/%{module}/GPL-2
%endif

%if 0%{?with_python2}
%py2_install
rm -f $RPM_BUILD_ROOT%{python2_sitearch}/%{module}/giacpy.cpp
rm -f $RPM_BUILD_ROOT%{python2_sitearch}/%{module}/GPL-2
%endif

%if 0%{?with_check}
%check
%if 0%{?with_python2}
pushd build/lib.linux-*-%{python2_version}
export PYTHONPATH=$RPM_BUILD_ROOT%{python2_sitearch}
%{__python2} -m doctest ../../%{module}/%{module}.pyx -v
popd
%endif

%if 0%{?with_python3}
pushd build/lib.linux-*-%{python3_version}
export PYTHONPATH=$RPM_BUILD_ROOT%{python3_sitearch}
%{__python3} -m doctest ../../%{module}/%{module}.pyx -v
popd
%endif
%endif

%if 0%{?with_python2}
%files -n python2-%{module}
%doc README.txt
%license %{module}/GPL-2
%{python2_sitearch}/%{module}/
%exclude %{python2_sitearch}/%{module}/*.h
%{python2_sitearch}/%{module}*.egg-info/

%files -n python2-%{module}-devel
%{python2_sitearch}/%{module}/*.h
%endif

%if 0%{?with_python3}
%files -n python3-%{module}
%doc README.txt
%license %{module}/GPL-2
%{python3_sitearch}/%{module}/
%exclude %{python3_sitearch}/%{module}/*.h
%{python3_sitearch}/%{module}*.egg-info/

%files -n python3-%{module}-devel
%{python3_sitearch}/%{module}/*.h
%endif

%changelog
* Wed Feb 05 2020 Antonio Trande <sagitter@fedoraproject.org> - 0.7.0-1
- Release 0.7.0

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

* Tue Sep 17 2019 Antonio Trande <sagitter@fedoraproject.org> - 0.6.9-1
- Release 0.6.9

* Mon Sep 16 2019 Antonio Trande <sagitter@fedoraproject.org> - 0.6.8-5
- Rebuild for giac-1.5.0.63
- Fix doctest failure

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

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

* Fri Jun 07 2019 Charalampos Stratakis <cstratak@redhat.com> - 0.6.8-2
- Recythonize the sources

* Wed Jun 05 2019 Antonio Trande <sagitter@fedoraproject.org> - 0.6.8-1
- Release 0.6.8

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

* Wed Oct 10 2018 Antonio Trande <sagitter@fedoraproject.org> - 0.6.7-1
- Release 0.6.7

* Mon Aug 27 2018 Antonio Trande <sagitter@fedoraproject.org> - 0.6.6-5
- Fix Cython requests

* Mon Aug 27 2018 Antonio Trande <sagitter@fedoraproject.org> - 0.6.6-4
- Deprecate Python2 on fedora 30+

* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.6.6-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 0.6.6-2
- Rebuilt for Python 3.7

* Sat Feb 10 2018 Antonio Trande <sagitter@fedoraproject.org> - 0.6.6-1
- Release 0.6.6

* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.6.5-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Sat Feb 03 2018 Antonio Trande <sagitter@fedoraproject.org> 0.6.5-3
- Rebuild for giac-1.4.9.45

* Sat Jan 27 2018 Antonio Trande <sagitter@fedoraproject.org> - 0.6.5-2
- Fix dependencies

* Mon Jan 15 2018 Antonio Trande <sagitter@fedoraproject.org> - 0.6.5-1
- Release 0.6.5
- Enable qcas support
- Packaging of the development files

* Fri Dec 22 2017 Antonio Trande <sagitter@fedoraproject.org> - 0.6.3-0.1
- Pre-release 0.6.3

* Sun Dec 17 2017 Antonio Trande <sagitter@fedoraproject.org> - 0.6.2-1
- Source package renamed with python- suffix as required by Python guidelines
- Source url grabbed by pythonhosted.org's repository
- Building processes restricted to the original directory

* Sat Dec 02 2017 Antonio Trande <sagitter@fedoraproject.org> - 0.6.2-1
- Initial package