Blob Blame History Raw
%global upname  pari_jupyter
%global srcname pari-jupyter

Name:           python-%{srcname}
Version:        1.3.2
Release:        2%{?dist}
Summary:        Jupyter kernel for PARI/GP

License:        GPLv3+
URL:            https://github.com/jdemeyer/pari_jupyter
Source0:        %{url}/archive/%{version}/%{srcname}-%{version}.tar.gz
# Adapt to recent versions of pari
# https://github.com/jdemeyer/pari_jupyter/pull/11
Patch0:         %{name}-pari.patch
# Tell Cython to compile for python 3
# Bug fix part is https://github.com/jdemeyer/pari_jupyter/pull/10
Patch1:         %{name}-cython.patch

BuildRequires:  gcc
BuildRequires:  pari-devel
BuildRequires:  pari-gp
BuildRequires:  pkgconfig(readline)
BuildRequires:  python3-devel
BuildRequires:  %{py3_dist cython}
BuildRequires:  %{py3_dist docutils}
BuildRequires:  %{py3_dist ipykernel}
BuildRequires:  %{py3_dist setuptools}

%description
This package contains a Jupyter kernel for PARI/GP.

%package     -n python3-%{srcname}
Summary:        Jupyter kernel for PARI/GP
Requires:       pari-gp
Requires:       python-jupyter-filesystem

%py_provides python3-PARIKernel

%description -n python3-%{srcname}
This package contains a Jupyter kernel for PARI/GP.

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

%build
# Regenerate the keyword list
python3 tools/generatekwlist.py %{_datadir}/pari/pari.desc > keywords.txt
sed -n '0,/var builtin/p' gp-mode/gp.js > before.txt
sed -n '/]);/,$p' gp-mode/gp.js > after.txt
cat before.txt keywords.txt after.txt > gp-mode/gp.js
rm before.txt keywords.txt after.txt

%py3_build
rst2html --no-datestamp README.rst README.html

%install
%py3_install

# Move the config file to the right place
mkdir -p %{buildroot}%{_sysconfdir}/jupyter/nbconfig
mv %{buildroot}%{_prefix}%{_sysconfdir}/jupyter/nbconfig/notebook.d \
   %{buildroot}%{_sysconfdir}/jupyter/nbconfig
rm -fr %{buildroot}%{_prefix}%{_sysconfdir}

%files       -n python3-%{srcname}
%doc README.html
%license LICENSE
%config(noreplace) %{_sysconfdir}/jupyter/nbconfig/notebook.d/gp-mode.json
%{_datadir}/jupyter/kernels/pari_jupyter/
%{_datadir}/jupyter/nbextensions/gp-mode/
%{python3_sitearch}/PARIKernel/
%{python3_sitearch}/pari_jupyter*

%changelog
* Fri Aug 13 2021 Jerry James <loganjerry@gmail.com> - 1.3.2-2
- Provide python3-PARIKernel
- Trim the -pari patch down to the essentials
- Provide URLs for upstream pull requests

* Wed Aug 11 2021 Jerry James <loganjerry@gmail.com> - 1.3.2-1
- Initial RPM