File python-jupyter_full_width.spec of Package python-jupyter_full_width

#
# spec file for package python-jupyter_full_width
#
# 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_full_width
Version:        1.2.0
Release:        0
Summary:        A button to allow Jupyter to use the full browser width
License:        MIT
Group:          Development/Languages/Python
Url:            https://github.com/JoaoFelipe/JupyterFullWidth
Source:         https://files.pythonhosted.org/packages/source/j/jupyter-full-width/jupyter_full_width-%{version}.tar.gz
BuildRequires:  %{python_module devel}
BuildRequires:  %{python_module setuptools}
BuildRequires:  fdupes
BuildRequires:  python-rpm-macros
# SECTION test requirements
BuildRequires:  %{python_module jupyter_notebook >= 5.1}
# /SECTION
Requires:       python-jupyter_notebook >= 5.1
%ifpython3
Requires(post):   python3-jupyter_notebook >= 5.1
Requires(preun):  python3-jupyter_notebook >= 5.1
%endif
BuildArch:      noarch

%python_subpackages

%description
This extension adds a button that makes notebooks use the full
browser width.

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

%build
%python_build

%install
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}

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

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

%post -n python3-jupyter_full_width
jupyter nbextension enable --py --system full_width || true

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

%files %{python_files}
%doc full_width/jupyter/readme.md
%{python_sitelib}/jupyter_full_width-*-py*.egg-info
%{python_sitelib}/full_width/
%python3_only %{_datadir}/jupyter/nbextensions/full_width/

%changelog
openSUSE Build Service is sponsored by