File python-jupyter_ipykernel.spec of Package python-jupyter_ipykernel

#
# spec file for package python-jupyter_ipykernel
#
# 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_ipykernel
Version:        4.8.2
Release:        0
Summary:        IPython Kernel for Jupyter
License:        BSD-3-Clause
Group:          Development/Languages/Python
Url:            https://github.com/ipython/ipykernel
Source:         https://files.pythonhosted.org/packages/source/i/ipykernel/ipykernel-%{version}.tar.gz
BuildRequires:  %{python_module devel}
BuildRequires:  %{python_module jupyter_client}
BuildRequires:  %{python_module jupyter_ipython >= 4.0.0}
BuildRequires:  %{python_module setuptools}
BuildRequires:  %{python_module tornado >= 4.0}
BuildRequires:  %{python_module traitlets >= 4.1.0}
BuildRequires:  fdupes
BuildRequires:  hicolor-icon-theme
BuildRequires:  python-rpm-macros
Requires:       python-jupyter_client
Requires:       python-jupyter_ipython >= 4.0.0
Requires:       python-tornado >= 4.0
Requires:       python-traitlets >= 4.1.0
%ifpython2
Requires:       python-typing
%endif
# typing is only built-in for later versions of python
%if 0%{?suse_version} <= 1320
Requires:       python-typing
%endif
BuildArch:      noarch
%python_subpackages

%description
This package provides the IPython kernel for Jupyter.

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

%build
%python_build

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

# Install icons
for x in 32 64 ; do
    mkdir -p %{buildroot}%{_datadir}/icons/hicolor/${x}x${x}/apps/
    cp ipykernel/resources/logo-${x}x${x}.png %{buildroot}%{_datadir}/icons/hicolor/${x}x${x}/apps/JupyterIPyKernel.png
done

rm -r %{buildroot}%{_datadir}/jupyter/

%{python_expand export PYTHONPATH=%{buildroot}%{$python_sitelib}
$python -m ipykernel install --display-name "Python %{$python_bin_suffix}" \
                             --name "python_%{$python_bin_suffix}" \
                             --prefix %{buildroot}%{_prefix}
}

%post -n %{python3_prefix}-jupyter_ipykernel
%icon_theme_cache_post

%postun -n %{python3_prefix}-jupyter_ipykernel
%icon_theme_cache_postun

%files %{python_files}
%defattr(-,root,root,-)
%doc COPYING.md README.md
%{python_sitelib}/*
%{_datadir}/jupyter/kernels/python_%{python_bin_suffix}/
%python3_only %{_datadir}/icons/hicolor/*/apps/JupyterIPyKernel.*

%changelog
openSUSE Build Service is sponsored by