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

#
# spec file for package python-jupyter_ipyparallel-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-%{**}}
Name:           python-jupyter_ipyparallel-doc
Version:        6.1.1
Release:        0
Summary:        Documentation for python-jupyter_ipyparallel
License:        BSD-3-Clause
Group:          Development/Languages/Python
Url:            https://github.com/ipython/ipyparallel
Source:         https://files.pythonhosted.org/packages/source/i/ipyparallel/ipyparallel-%{version}.tar.gz
BuildRequires:  fdupes
BuildRequires:  python-rpm-macros
BuildRequires:  %{python_module jupyter_ipyparallel = %{version}}
%if %{with tests}
# Test requirements
BuildRequires:  %{python_module jupyter_ipython-iptest}
BuildRequires:  %{python_module jupyter_nbformat}
%endif
# Documentation requirements
%if %{with pdf} || %{with html}
BuildRequires:  python3-Sphinx
%endif
%if %{with pdf}
BuildRequires:  python3-Sphinx-latex
BuildRequires:  tex(unicode-math.sty)
%endif
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch
Provides:       %{name}-html = %{version}
Provides:       %{name}-pdf = %{version}
Obsoletes:      %{name}-html < %{version}
Obsoletes:      %{name}-pdf < %{version}
Provides:       %{python_module jupyter_ipyparallel-doc = %{version}}

%description
Documentation and help files for python-jupyter_ipyparallel.

%prep
%setup -q -n ipyparallel-%{version}
find examples -name "*.py" -exec sed -i "s|^#!/usr/bin/env python$|#!%__python3|" {} \;

%build
# Build the documentation
pushd docs
%if %{with html}
make html
rm -rf build/html/.buildinfo
%endif
%if %{with pdf}
make latexpdf
%endif
popd

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

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

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

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

%if %{with tests}
%check
export LANG=en_US.UTF-8
%python_expand iptest-%{$python_bin_suffix}
%endif

%files
%defattr(-,root,root,-)
%doc COPYING.md
%{_docdir}/python-jupyter_ipyparallel/

%changelog
openSUSE Build Service is sponsored by