File python-jupyter_ipython-doc.spec of Package python-jupyter_ipython

#
# spec file for package python-jupyter_ipython-doc
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


# PDF documentation currently broken
%bcond_with pdf

%bcond_without html
%bcond_without tests

%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define         oldpython python
Name:           python-jupyter_ipython-doc
Version:        6.2.1
Release:        0
Summary:        Documentation for python3-jupyter_ipython
License:        BSD-3-Clause
Group:          Development/Languages/Python
Url:            https://github.com/ipython/ipython
Source:         https://files.pythonhosted.org/packages/source/i/ipython/ipython-%{version}.tar.gz
BuildRequires:  fdupes
BuildRequires:  python-rpm-macros
%if  %{with tests}
# Test Requirements
BuildRequires:  python3-jedi
BuildRequires:  python3-jupyter_ipykernel
BuildRequires:  python3-jupyter_ipyparallel
BuildRequires:  python3-jupyter_ipython = %{version}
BuildRequires:  python3-jupyter_ipython-iptest = %{version}
BuildRequires:  python3-jupyter_ipywidgets
BuildRequires:  python3-jupyter_nbconvert
BuildRequires:  python3-jupyter_nbformat
BuildRequires:  python3-jupyter_notebook
BuildRequires:  python3-jupyter_qtconsole
BuildRequires:  python3-matplotlib
BuildRequires:  python3-nose
BuildRequires:  python3-testpath
%endif
# Documentation requirements
%if %{with pdf} || %{with html}
BuildRequires:  graphviz
BuildRequires:  graphviz-gnome
BuildRequires:  python3-Sphinx
BuildRequires:  python3-matplotlib
BuildRequires:  python3-numpydoc
BuildRequires:  python3-requests
%endif
%if %{with pdf}
BuildRequires:  python3-Sphinx-latex
%endif
BuildArch:      noarch
Provides:       %{oldpython}-jupyter_ipython-doc-html = %{version}
Provides:       %{oldpython}-jupyter_ipython-doc-pdf = %{version}
Obsoletes:      %{oldpython}-jupyter_ipython-doc-html < %{version}
Obsoletes:      %{oldpython}-jupyter_ipython-doc-pdf < %{version}
Provides:       %{python_module jupyter_ipython-doc = %{version}}
Provides:       %{python_module jupyter_ipython-doc-html = %{version}}
Provides:       %{python_module jupyter_ipython-doc-pdf = %{version}}
Obsoletes:      %{python_module jupyter_ipython-doc < %{version}}
Obsoletes:      %{python_module jupyter_ipython-doc-html < %{version}}
Obsoletes:      %{python_module jupyter_ipython-doc-pdf < %{version}}

%description
Documentation and help files for python3-jupyter_ipython.

%prep
%setup -q -n ipython-%{version}

find examples -type f -name "*.py" -exec sed -i "s|^#!/usr/bin/env python$|#!/usr/bin/python3|" {} \;

%build
# Build the documentation
export LANG="en_US.UTF-8"
pushd docs
%if %{with pdf}
make pdf
%endif
%if %{with html}
make html
rm -rf build/html/.buildinfo
%endif
popd

%install
mkdir -p %{buildroot}%{_docdir}/python-jupyter_ipython

%if %{with pdf}
cp docs/build/latex/*.pdf %{buildroot}%{_docdir}/python-jupyter_ipython/
%endif

%if %{with html}
cp -r docs/build/html %{buildroot}%{_docdir}/python-jupyter_ipython/
%endif

cp -r examples %{buildroot}%{_docdir}/python-jupyter_ipython/
%fdupes %{buildroot}%{_docdir}/python-jupyter_ipython/

%if %{with tests}
%check
export LANG="en_US.UTF-8"
pushd docs
iptest-%{python3_bin_suffix}
popd
%endif

%files
%defattr(-,root,root,-)
%doc COPYING.rst docs/source/about/license_and_copyright.rst
%{_docdir}/python-jupyter_ipython/

%changelog
openSUSE Build Service is sponsored by