%global modname cypari2
Name: python-%{modname}
Version: 1.1.3
Release: 4%{?dist}
Summary: A Python interface to the number theory library pari
License: GPLv2+
URL: https://github.com/defeo/%{modname}
Source0: https://github.com/defeo/%{modname}/archive/%{version}/%{modname}-%{version}.tar.gz
# Previously sagemath-pari.patch
Patch0: %{name}-pari.patch
# Correct off by one miscalculation of start of string to convert to oct/hex
Patch1: %{name}-offbyone.patch
BuildRequires: gmp-devel
BuildRequires: pari-devel
BuildRequires: pari-gp
%global _description \
A Python interface to the number theory library pari.
%description %{_description}
%package -n python2-%{modname}
Summary: %{summary}
%{?python_provide:%python_provide python2-%{modname}}
BuildRequires: python2-devel
BuildRequires: python2-Cython
BuildRequires: python2-cysignals-devel >= 1.6.4
BuildRequires: python2-six
%description -n python2-%{modname} %{_description}
%package -n python2-%{modname}-devel
Summary: %{summary} headers files
%{?python_provide:%python_provide python2-%{modname}-devel}
Requires: python2-%{modname}
%description -n python2-%{modname}-devel %{_description}
%package -n python3-%{modname}
Summary: %{summary}
%{?python_provide:%python_provide python3-%{modname}}
BuildRequires: python3-devel
BuildRequires: python3-Cython
BuildRequires: python3-cysignals-devel >= 1.6.4
BuildRequires: python3-six
%description -n python3-%{modname} %{_description}
%package -n python3-%{modname}-devel
Summary: %{summary} headers files
%{?python_provide:%python_provide python3-%{modname}-devel}
Requires: python3-%{modname}
%description -n python3-%{modname}-devel %{_description}
%package doc
Summary: Documentation for %{name}
BuildRequires: python-sphinx
Requires: python-%{modname}
BuildArch: noarch
%description doc
Documentation and examples for %{name}.
%prep
%setup -q -n %{modname}-%{version}
%patch0 -p0
%patch1 -p0
%build
%py2_build
%py3_build
pushd docs
%__make html
popd
%install
%py2_install
%py3_install
mkdir -p %{buildroot}%{_docdir}/%{name}
cp -farp docs/build/html %{buildroot}%{_docdir}/%{name}
rm %{buildroot}%{_docdir}/%{name}/html/.buildinfo
%check
PATH=%{buildroot}%{_bindir}:$PATH
PYTHONPATH=%{buildroot}%{python2_sitearch}
export PATH PYTHONPATH
%{__python2} tests/rundoctest.py || :
PYTHONPATH=%{buildroot}%{python3_sitearch}
export PYTHONPATH
%{__python3} tests/rundoctest.py || :
%files -n python2-%{modname}
%license LICENSE
%doc README.rst
%{python2_sitearch}/%{modname}
%{python2_sitearch}/%{modname}-*.egg-info
%exclude %{python2_sitearch}/%{modname}/*.h
%exclude %{python2_sitearch}/%{modname}/*.pxd
%exclude %{python2_sitearch}/%{modname}/*.pxi
%files -n python2-%{modname}-devel
%{python2_sitearch}/%{modname}/*.h
%{python2_sitearch}/%{modname}/*.pxd
%{python2_sitearch}/%{modname}/*.pxi
%files -n python3-%{modname}
%license LICENSE
%doc README.rst
%{python3_sitearch}/%{modname}
%{python3_sitearch}/%{modname}-*.egg-info
%exclude %{python3_sitearch}/%{modname}/*.h
%exclude %{python3_sitearch}/%{modname}/*.pxd
%exclude %{python3_sitearch}/%{modname}/*.pxi
%files -n python3-%{modname}-devel
%{python3_sitearch}/%{modname}/*.h
%{python3_sitearch}/%{modname}/*.pxd
%{python3_sitearch}/%{modname}/*.pxi
%files doc
%dir %{_docdir}/%{name}
%{_docdir}/%{name}/html
%changelog
* Fri Nov 10 2017 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 1.1.3-5
- Add patch to correct pointer miscalculation (crashes on 32 bit glibc)
- Ignore one error that happens only on 32 bit %%check
* Fri Nov 10 2017 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 1.1.3-4
- Add missing build requires for %%check
* Thu Nov 09 2017 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 1.1.3-3
- Remove conditionals for doc package and %%check
* Thu Nov 09 2017 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 1.1.3-2
- Correct Source URL
- Temporarily disable doc and check as need to update cysignals
* Thu Nov 09 2017 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 1.1.3-1
- Update to 1.1.3
- Added doc subpackage and %%check section
* Wed Nov 08 2017 pcpa <paulo.cesar.pereira.de.andrade@gmail.com> - 1.0.0-1
- Initial python-cypari2 spec.