%global giacver 1.9.0.59
%global pypi_name giacpy
%global with_check 1
# Architectures currently not supported
# http://xcas.e.ujf-grenoble.fr/XCAS/viewtopic.php?f=19&t=1723
ExcludeArch: aarch64 %{power64} s390x
Name: python-%{pypi_name}
Version: 0.7.3
Release: %autorelease
Summary: Python binding for Giac
License: GPLv2+
URL: http://webusers.imj-prg.fr/~frederic.han/xcas/giacpy/
Source0: %pypi_source
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).
%package -n python3-%{pypi_name}
Summary: Python3 binding for Giac
%{?python_provide:%python_provide python3-%{pypi_name}}
BuildRequires: python3-devel
BuildRequires: python3-setuptools
BuildRequires: %{_bindir}/cython
BuildRequires: libqcas-devel
Requires: python3dist(cython)
Requires: giac-doc >= %{giacver}
Obsoletes: python2-%{pypi_name} < 0:%{version}
%description -n python3-%{pypi_name}
A Cython frontend to the c++ library Giac (Computer Algebra System).
%package -n python3-%{pypi_name}-devel
Summary: Development libraries of python3-%{pypi_name}
Requires: python3-%{pypi_name}%{?_isa}
%description -n python3-%{pypi_name}-devel
Development libraries of Python3 %{pypi_name}.
%prep
%autosetup -n %{pypi_name}-%{version} -p1
rm -rf *.egg-info
# Remove the cythonized files in order to regenerate them during build.
rm $(grep -rl '/\* Generated by Cython')
%build
export CFLAGS="%{optflags} %(pkg-config --cflags Qt5Xml Qt5Widgets)"
%py3_build -- --enable-qcas --executable="%{__python3} -s"
%install
%py3_install
rm -f $RPM_BUILD_ROOT%{python3_sitearch}/%{pypi_name}/giacpy.cpp
rm -f $RPM_BUILD_ROOT%{python3_sitearch}/%{pypi_name}/GPL-2
%if 0%{?with_check}
%check
pushd build/lib.linux-*
export PYTHONPATH=$RPM_BUILD_ROOT%{python3_sitearch}
%{__python3} -m doctest ../../%{pypi_name}/%{pypi_name}.pyx -v
popd
%endif
%files -n python3-%{pypi_name}
%doc README.txt
%license %{pypi_name}/GPL-2
%{python3_sitearch}/%{pypi_name}/
%exclude %{python3_sitearch}/%{pypi_name}/*.h
%{python3_sitearch}/%{pypi_name}*.egg-info/
%files -n python3-%{pypi_name}-devel
%{python3_sitearch}/%{pypi_name}/*.h
%changelog
%autochangelog