File python3-jupyter_core.spec of Package python3-jupyter_core
#
# spec file for package python3-jupyter_core
#
# 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_core
Version: 4.1.0
Release: 0
Summary: Base package on which Jupyter projects rely
License: BSD-3-Clause
Group: Development/Languages/Python
Url: http://jupyter.org
Source: https://files.pythonhosted.org/packages/source/j/jupyter_core/jupyter_core-%{version}.tar.gz
BuildRequires: python3-devel >= 3.3
BuildRequires: python3-ipython_genutils
BuildRequires: python3-setuptools
BuildRequires: python3-traitlets
# Test requirements
BuildRequires: python3-mock
BuildRequires: python3-pbr
BuildRequires: python3-pytest
Requires: python3 >= 3.3
Requires: python3-ipython_genutils
Requires: python3-traitlets
Recommends: python3-jupyter_ipython
Requires(post): update-alternatives
Requires(postun): update-alternatives
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
%description
Core common functionality of Jupyter projects.
This package contains base application classes and configuration inherited by
other projects. It doesn't do much on its own.
There is no reason to install this package on its own. It will be pulled in
as a dependency by packages that require it.
%prep
%setup -q -n jupyter_core-%{version}
%build
python3 setup.py build
%install
python3 setup.py install --prefix=%{_prefix} --root=%{buildroot}
# Prepare for update-alternatives usage
mv %{buildroot}%{_bindir}/jupyter %{buildroot}%{_bindir}/jupyter3
mv %{buildroot}%{_bindir}/jupyter-migrate %{buildroot}%{_bindir}/jupyter3-migrate
ln -s -f %{_bindir}/jupyter3 %{buildroot}%{_bindir}/jupyter-%{py3_ver}
ln -s -f %{_bindir}/jupyter3-migrate %{buildroot}%{_bindir}/jupyter-migrate-%{py3_ver}
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
for p in jupyter jupyter-migrate ; do
ln -s -f %{_sysconfdir}/alternatives/$p %{buildroot}%{_bindir}/$p
# create a dummy target for /etc/alternatives/$p
touch %{buildroot}%{_sysconfdir}/alternatives/$p
done
%check
pushd jupyter_core/tests
# test_migrate requires files not found in the package
rm test_migrate.py
ln -s %{buildroot}%{_bindir}/jupyter-%{py3_ver} ./jupyter
export "PATH=%{buildroot}%{_bindir}:./:$PATH"
# test_not_on_path removes the environment variables needed to make the tests work
PYTHONPATH=%{buildroot}%{python3_sitelib} py.test -k "not test_not_on_path"
popd
%post
%_sbindir/update-alternatives \
--install %{_bindir}/jupyter jupyter %{_bindir}/jupyter-%{py3_ver} 30 \
--slave %{_bindir}/jupyter-migrate jupyter-migrate %{_bindir}/jupyter-migrate-%{py3_ver}
%preun
if [ $1 -eq 0 ] ; then
%_sbindir/update-alternatives --remove jupyter %{_bindir}/jupyter-%{py3_ver}
fi
%files
%defattr(-,root,root,-)
%doc CONTRIBUTING.md COPYING.md README.md
%{_bindir}/jupyter
%{_bindir}/jupyter-migrate
%{_bindir}/jupyter3
%{_bindir}/jupyter3-migrate
%{_bindir}/jupyter-%{py3_ver}
%{_bindir}/jupyter-migrate-%{py3_ver}
%ghost %{_sysconfdir}/alternatives/jupyter
%ghost %{_sysconfdir}/alternatives/jupyter-migrate
%{python3_sitelib}/jupyter.py
%{python3_sitelib}/__pycache__/jupyter.*.pyc
%{python3_sitelib}/jupyter_core/
%{python3_sitelib}/jupyter_core-%{version}-*.egg-info
%changelog