Blob Blame History Raw
# Unset -s on python shebang - ensure that extensions installed with pip
# to user locations are seen and properly loaded
%global py3_shebang_flags %(echo %py3_shebang_flags | sed s/s//)

%global pypi_name nbconvert

Name:           python-%{pypi_name}
Version:        6.4.5
Release:        %autorelease
Summary:        Converting Jupyter Notebooks

License:        BSD and MIT
URL:            http://jupyter.org
Source0:        %pypi_source


BuildArch:      noarch

BuildRequires:  python3-pandocfilters
BuildRequires:  python3-jupyterlab_pygments
BuildRequires:  python3-setuptools
BuildRequires:  python3-testpath
BuildRequires:  python3-devel


%bcond_without doc
%bcond_without check

%if %{with doc}
BuildRequires:  python3-entrypoints
BuildRequires:  python3-ipython
BuildRequires:  python3-ipython-sphinx
BuildRequires:  python3-nbformat
BuildRequires:  python3-nbsphinx
BuildRequires:  python3-sphinx
BuildRequires:  python3-sphinx_rtd_theme
BuildRequires:  python3-sphinxcontrib-github-alt
BuildRequires:  python3-beautifulsoup4
BuildRequires:  pandoc
%endif

%if %{with check}
BuildRequires:  python3-bleach
BuildRequires:  python3-entrypoints
BuildRequires:  python3-defusedxml
BuildRequires:  python3-ipykernel
BuildRequires:  python3-ipywidgets
BuildRequires:  python3-jinja2
BuildRequires:  python3-jupyter-core
BuildRequires:  python3-mistune
BuildRequires:  python3-nbclient
BuildRequires:  python3-nbformat
BuildRequires:  python3-nose
BuildRequires:  python3-pebble
BuildRequires:  python3-pytest
BuildRequires:  texlive-xetex
# Spent far too much time chasing required tex packages
# installing everything - tests pass!
BuildRequires:  texlive-scheme-full
BuildRequires:  inkscape
BuildRequires:  pandoc
%endif


%description
The nbconvert tool, jupyter nbconvert, converts notebooks to various other 
formats via Jinja templates. The nbconvert tool allows you to convert an 
.ipynb notebook file into various static formats including HTML, LaTeX, 
PDF, Reveal JS, Markdown (md), ReStructured Text (rst) and executable script.

%package -n     python3-%{pypi_name}
Summary:        Converting Jupyter Notebooks

Recommends:     inkscape
Recommends:     pandoc

%description -n python3-%{pypi_name}

The nbconvert tool, jupyter nbconvert, converts notebooks to various other 
formats via Jinja templates. The nbconvert tool allows you to convert an 
.ipynb notebook file into various static formats including HTML, LaTeX, 
PDF, Reveal JS, Markdown (md), ReStructured Text (rst) and executable script.

%package -n python-%{pypi_name}-doc
Summary:        Documentation for nbconvert
%description -n python-%{pypi_name}-doc
Documentation for nbconvert

%prep
%autosetup -p1 -n %{pypi_name}-%{version}
rm -rf %{pypi_name}.egg-info

echo "nbsphinx_allow_errors = True" >> docs/source/conf.py


%build
%py3_build

%if %{with doc}
export PYTHONPATH=$(pwd)
sphinx-build-3 docs/source html
rm -rf html/.{doctrees,buildinfo}
%endif

%install
%py3_install

# fix permissions and shebangs
pathfix.py -pni %{__python3} %{buildroot}%{python3_sitelib}/%{pypi_name}/nbconvertapp.py
chmod 755 %{buildroot}%{python3_sitelib}/%{pypi_name}/nbconvertapp.py

%if %{with check}
%check

# test_webpdf needs pyppeteer
# rest of the disabled tests fail for reasons that I do not understand
%{__python3} -m pytest -v -k "not test_webpdf_without_chromium and not test_pdf and not test_webpdf_with_chromium and not test_webpdf and not test_embedding_images_htmlexporter"

%endif

%files -n python3-%{pypi_name}
%license LICENSE
%doc docs/README.md
%{_bindir}/jupyter-nbconvert
%{_bindir}/jupyter-dejavu
%{python3_sitelib}/%{pypi_name}-%{version}-py%{python3_version}.egg-info
%{python3_sitelib}/%{pypi_name}/
%{_datadir}/jupyter/%{pypi_name}/templates/

%if %{with doc}
%files -n python-%{pypi_name}-doc
%doc html
%endif

%changelog
%autochangelog