6523a2c
# Unset -s on python shebang - ensure that extensions installed with pip
6523a2c
# to user locations are seen and properly loaded
9db3b31
%undefine _py3_shebang_s
6523a2c
fb7b1e1
%global pypi_name nbconvert
fb7b1e1
3ede596
%bcond_without doc
3ede596
%bcond_without check
27b70c9
fb7b1e1
Name:           python-%{pypi_name}
a4c8c60
Version:        7.9.1
a858a71
Release:        %autorelease
fb7b1e1
Summary:        Converting Jupyter Notebooks
fb7b1e1
fb7b1e1
License:        BSD and MIT
fb7b1e1
URL:            http://jupyter.org
2f9143e
Source0:        %pypi_source
054997d
fb7b1e1
BuildArch:      noarch
2f9143e
fb7b1e1
BuildRequires:  python3-devel
27b70c9
# Deps not covered by upstream metadata
82c421a
%if %{with doc}
6aadcbe
BuildRequires:  python3-ipython-sphinx
6aadcbe
BuildRequires:  pandoc
82c421a
%endif
6fa94ec
fb7b1e1
%description
fb7b1e1
The nbconvert tool, jupyter nbconvert, converts notebooks to various other 
fb7b1e1
formats via Jinja templates. The nbconvert tool allows you to convert an 
fb7b1e1
.ipynb notebook file into various static formats including HTML, LaTeX, 
fb7b1e1
PDF, Reveal JS, Markdown (md), ReStructured Text (rst) and executable script.
fb7b1e1
fb7b1e1
%package -n     python3-%{pypi_name}
fb7b1e1
Summary:        Converting Jupyter Notebooks
f17cf84
054997d
Recommends:     inkscape
ae5f8eb
Recommends:     pandoc
fb7b1e1
fb7b1e1
%description -n python3-%{pypi_name}
fb7b1e1
fb7b1e1
The nbconvert tool, jupyter nbconvert, converts notebooks to various other 
fb7b1e1
formats via Jinja templates. The nbconvert tool allows you to convert an 
fb7b1e1
.ipynb notebook file into various static formats including HTML, LaTeX, 
fb7b1e1
PDF, Reveal JS, Markdown (md), ReStructured Text (rst) and executable script.
fb7b1e1
fb7b1e1
%package -n python-%{pypi_name}-doc
fb7b1e1
Summary:        Documentation for nbconvert
fb7b1e1
%description -n python-%{pypi_name}-doc
fb7b1e1
Documentation for nbconvert
fb7b1e1
fb7b1e1
%prep
054997d
%autosetup -p1 -n %{pypi_name}-%{version}
fb7b1e1
rm -rf %{pypi_name}.egg-info
82a12ba
echo "nbsphinx_allow_errors = True" >> docs/source/conf.py
4a7222a
# Remove coverage testing
4a7222a
sed -i '/"pytest-cov",/d' pyproject.toml
27b70c9
# Packages not available in Fedora
2f320b1
sed -i '/"pytest-dependency",/d' pyproject.toml
2f320b1
sed -i '/pyppeteer/d' pyproject.toml
2f320b1
sed -i 's/"sphinx==.*"/"sphinx"/' pyproject.toml
2f320b1
27b70c9
%generate_buildrequires
27b70c9
%pyproject_buildrequires %{?with_check:-x test} %{?with_doc:-x docs}
82a12ba
82a12ba
fb7b1e1
%build
27b70c9
%pyproject_wheel
fb7b1e1
82c421a
%if %{with doc}
52600a9
export PYTHONPATH=$(pwd)
6fa94ec
sphinx-build-3 docs/source html
fb7b1e1
rm -rf html/.{doctrees,buildinfo}
82c421a
%endif
fb7b1e1
fb7b1e1
%install
27b70c9
%pyproject_install
27b70c9
%pyproject_save_files %{pypi_name}
fb7b1e1
040b559
# fix permissions and shebangs
9db3b31
%py3_shebang_fix %{buildroot}%{python3_sitelib}/%{pypi_name}/nbconvertapp.py
fb7b1e1
chmod 755 %{buildroot}%{python3_sitelib}/%{pypi_name}/nbconvertapp.py
fb7b1e1
f17cf84
%if %{with check}
f17cf84
%check
a4c8c60
# Some tests are using templates provided by the previous
a4c8c60
# version of nbconvert.
a4c8c60
%pytest -W ignore::DeprecationWarning -k "\
2f320b1
    not test_convert_full_qualified_name and \
a4c8c60
    not test_post_processor and \
a4c8c60
    not test_language_code_error and \
a4c8c60
    not test_language_code_not_set and \
a4c8c60
    not test_mermaid_output and \
a4c8c60
    not test_set_language_code"
f17cf84
%endif
f17cf84
27b70c9
%files -n python3-%{pypi_name} -f %{pyproject_files}
fb7b1e1
%doc docs/README.md
be2a201
%{_bindir}/jupyter-nbconvert
f8e3fe2
%{_bindir}/jupyter-dejavu
82a12ba
%{_datadir}/jupyter/%{pypi_name}/templates/
fb7b1e1
82c421a
%if %{with doc}
fb7b1e1
%files -n python-%{pypi_name}-doc
6fa94ec
%doc html
82c421a
%endif
fb7b1e1
fb7b1e1
%changelog
a858a71
%autochangelog