File python-jupyter_widgetsnbextension.spec of Package python-jupyter_widgetsnbextension

#
# spec file for package python-jupyter_widgetsnbextension
#
# 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-%{**}}
%define         oldpython python
Name:           python-jupyter_widgetsnbextension
Version:        3.2.1
Release:        0
Summary:        IPython HTML widgets for Jupyter
License:        BSD-3-Clause
Group:          Development/Languages/Python
Url:            https://github.com/jupyter-widgets/ipywidgets/tree/master/widgetsnbextension
Source:         https://files.pythonhosted.org/packages/py2.py3/w/widgetsnbextension/widgetsnbextension-%{version}-py2.py3-none-any.whl
# This package is created from inside the ipywidgets github project at the same time, so use its license.
Source10:       https://raw.githubusercontent.com/jupyter-widgets/ipywidgets/%%40jupyter-widgets/notebook-manager%%40%{version}/COPYING.md
Source11:       https://raw.githubusercontent.com/jupyter-widgets/ipywidgets/%%40jupyter-widgets/notebook-manager%%40%{version}/LICENSE
BuildRequires:  %{python_module certifi}
BuildRequires:  %{python_module devel}
BuildRequires:  %{python_module jupyter_notebook >= 4.4.1}
BuildRequires:  %{python_module pip}
BuildRequires:  %{python_module setuptools}
BuildRequires:  fdupes
BuildRequires:  python-rpm-macros
Requires:       python-certifi
Requires:       python-jupyter_notebook >= 4.4.1
%ifpython2
Requires:       python3-jupyter_widgetsnbextension
%endif
%ifpython3
Provides:       %{oldpython}-jupyter_widgetsnbextension-nbextension = %{version}
Obsoletes:      %{oldpython}-jupyter_widgetsnbextension-nbextension < %{version}
%endif
BuildArch:      noarch
%python_subpackages

%description
Interactive HTML widgets for Jupyter notebooks.

Requires the corresponding package for your kernel. i.e. Python users
would also install `ipywidgets`. Refer to that package's
documentation for usage instructions.

%prep
%setup -c -T
cp %{SOURCE10} .
cp %{SOURCE11} .

%build
# not needed

%install
%python_expand pip%{$python_bin_suffix} install --root=%{buildroot} %{SOURCE0}

if [ "$(dirname %{_prefix}/etc/jupyter)" != "$(dirname %{_sysconfdir}/jupyter)" ]; then
mkdir -p %{buildroot}%{_sysconfdir}
mv %{buildroot}%{_prefix}/etc/jupyter %{buildroot}%{_sysconfdir}/jupyter
rm -d %{buildroot}%{_prefix}/etc
fi

%python_expand %fdupes %{buildroot}%{$python_sitelib}
%{fdupes %{buildroot}%{_datadir}/jupyter/ %{buildroot}%{python3_sitelib}}

%files %{python_files}
%defattr(-,root,root,-)
%doc COPYING.md LICENSE
%{python_sitelib}/widgetsnbextension/
%{python_sitelib}/widgetsnbextension-%{version}.dist-info
%python3_only %{_datadir}/jupyter/nbextensions/jupyter-js-widgets/
%python3_only %config %{_sysconfdir}/jupyter/nbconfig/notebook.d/widgetsnbextension.json

%changelog
openSUSE Build Service is sponsored by