File python-jupyter_nbpresent.spec of Package python-jupyter_nbpresent

#
# spec file for package python-jupyter_nbpresent
#
# 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/
#


%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name:           python-jupyter_nbpresent
Version:        3.0.0
Release:        0
Summary:        Slide generator for Jupyter Notebooks
License:        BSD-3-Clause
Group:          Development/Languages/Python
Url:            https://github.com/Anaconda-Platform/nbpresent
Source:         https://files.pythonhosted.org/packages/source/n/nbpresent/nbpresent-%{version}.tar.gz
BuildRequires:  %{python_module devel}
BuildRequires:  %{python_module jupyter_notebook}
BuildRequires:  %{python_module setuptools}
BuildRequires:  fdupes
BuildRequires:  python-rpm-macros
# SECTION test requirements
BuildRequires:  %{python_module coverage}
BuildRequires:  %{python_module nose}
BuildRequires:  %{python_module requests}
BuildRequires:  python-mock
# /SECTION
Requires:       python-jupyter_notebook
Recommends:     python-jupyter_nbbrowserpdf
%ifpython2
Requires:       python3-jupyter_nbpresent = %{version}
%endif
%ifpython3
Requires(post):   python3-jupyter_notebook
Requires(preun):  python3-jupyter_notebook
%endif
BuildArch:      noarch

%python_subpackages

%description
This module remixes Jupyter Notebooks into interactive slideshows.

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

%build
%python_build

%install
%python_install
%python_expand chmod a-x %{buildroot}%{$python_sitelib}/nbpresent/tasks/*.py
%python_expand %fdupes %{buildroot}%{$python_sitelib}

export PYTHONPATH=%{buildroot}%{python3_sitelib}
jupyter nbextension install --py --prefix %{buildroot}%{_prefix} nbpresent

%{fdupes %{buildroot}%{_datadir}/jupyter/ %{buildroot}%{python3_sitelib}}

%post -n python3-jupyter_nbpresent
jupyter nbextension enable --py --system nbpresent || true

%preun -n python3-jupyter_nbpresent
if [ $1 = 0 ] && [ -d %{python3_sitelib}/nbpresent/ ] ; then
    jupyter nbextension disable --py --system nbpresent || true
fi

%files %{python_files}
%doc README.md README.rst
%license LICENSE
%{python_sitelib}/nbpresent-*-py*.egg-info
%{python_sitelib}/nbpresent/
%python3_only %{_bindir}/nbpresent
%python3_only %{_datadir}/jupyter/nbextensions/nbpresent/

%changelog
openSUSE Build Service is sponsored by