File python3-jupyter_client.spec of Package python3-jupyter_client

#
# spec file for package python3-jupyter_client
#
# Copyright (c) 2016 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/
#


Name:           python3-jupyter_client
Version:        4.3.0
Release:        0
Summary:        Jupyter protocol implementation and client libraries
License:        BSD-3-Clause
Group:          Development/Languages/Python
Url:            http://jupyter.org
Source:         https://files.pythonhosted.org/packages/source/j/jupyter_client/jupyter_client-%{version}.tar.gz
BuildRequires:  python3-devel
BuildRequires:  python3-jupyter_core
BuildRequires:  python3-pyzmq >= 13
BuildRequires:  python3-setuptools
BuildRequires:  python3-traitlets
# Test Requirements
BuildRequires:  python3-nose
BuildRequires:  python3-pytest
Requires:       python3-jupyter_core
Requires:       python3-pyzmq >= 13
Requires:       python3-traitlets
Requires(post): update-alternatives
Requires(postun): update-alternatives
BuildConflicts: python3-buildservice-tweak
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildArch:      noarch

%description
This package contains the reference implementation of the Jupyter protocol.
It also provides client and kernel management APIs for working with kernels.

It also provides the jupyter kernelspec entrypoint for installing kernelspecs
for use with Jupyter frontends.

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

%build
python3 setup.py build

%install
python3 setup.py install --prefix=%{_prefix} --root=%{buildroot}

# Prepare for update-alternatives usage
mv %{buildroot}%{_bindir}/jupyter-kernelspec %{buildroot}%{_bindir}/jupyter3-kernelspec
ln -s -f %{_bindir}/jupyter3-kernelspec %{buildroot}%{_bindir}/jupyter-kernelspec-%{py3_ver} 

mkdir -p %{buildroot}%{_sysconfdir}/alternatives
ln -s -f %{_sysconfdir}/alternatives/jupyter-kernelspec %{buildroot}%{_bindir}/jupyter-kernelspec
# create a dummy target for /etc/alternatives/jupyter-kernelspec
touch %{buildroot}%{_sysconfdir}/alternatives/jupyter-kernelspec

%check
# We can't test the kernel manager because that requires the ipython kernel,
# which requires this package, causing a dependency loop.  So those tests are
# excluded
pushd jupyter_client/tests
PYTHONPATH=%{buildroot}%{python3_sitelib} nosetests -I test_multikernelmanager.py  -I test_kernelmanager.py
popd

%post
%_sbindir/update-alternatives \
   --install %{_bindir}/jupyter-kernelspec jupyter-kernelspec %{_bindir}/jupyter-kernelspec-%{py3_ver} 30

%preun
if [ $1 -eq 0 ] ; then
    %_sbindir/update-alternatives --remove jupyter-kernelspec %{_bindir}/jupyter-kernelspec-%{py3_ver}
fi

%files
%defattr(-,root,root,-)
%doc CONTRIBUTING.md COPYING.md README.md
%{_bindir}/jupyter-kernelspec
%{_bindir}/jupyter3-kernelspec
%{_bindir}/jupyter-kernelspec-%{py3_ver}
%ghost %{_sysconfdir}/alternatives/jupyter-kernelspec
%{python3_sitelib}/*

%changelog
openSUSE Build Service is sponsored by