File python-jupyter_core.spec of Package python-jupyter_core
#
# spec file for package python-jupyter_core
#
# Copyright (c) 2015 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: python-jupyter_core
Version: 4.0.6
Release: 0
Summary: Base package on which Jupyter projects rely
License: BSD-3-Clause
Group: Development/Languages/Python
Url: http://jupyter.org
Source: https://pypi.python.org/packages/source/j/jupyter_core/jupyter_core-%{version}.tar.gz
BuildRequires: python-devel >= 2.7
BuildRequires: python-ipython_genutils
BuildRequires: python-traitlets
# Test requirements
BuildRequires: python-pytest
# Python 2.7 test requirements
BuildRequires: python-mock
Requires: python >= 2.7
Requires: python-ipython_genutils
Requires: python-traitlets
Recommends: python-jupyter_ipython
Requires(post): update-alternatives
Requires(postun): update-alternatives
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%else
BuildArch: noarch
%endif
%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
python setup.py build
%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
# Prepare for update-alternatives usage
mv %{buildroot}%{_bindir}/jupyter %{buildroot}%{_bindir}/jupyter2
mv %{buildroot}%{_bindir}/jupyter-migrate %{buildroot}%{_bindir}/jupyter2-migrate
ln -s -f %{_bindir}/jupyter2 %{buildroot}%{_bindir}/jupyter-%{py_ver}
ln -s -f %{_bindir}/jupyter2-migrate %{buildroot}%{_bindir}/jupyter-migrate-%{py_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
# test_migrate requires files not found in the package
pushd jupyter_core/tests
rm test_migrate.py
PYTHONPATH=%{buildroot}%{python_sitelib} py.test
popd
%post
%_sbindir/update-alternatives \
--install %{_bindir}/jupyter jupyter %{_bindir}/jupyter-%{py_ver} 30 \
--slave %{_bindir}/jupyter-migrate jupyter-migrate %{_bindir}/jupyter-migrate-%{py_ver}
%preun
if [ $1 -eq 0 ] ; then
%_sbindir/update-alternatives --remove jupyter %{_bindir}/jupyter-%{py_ver}
fi
%files
%defattr(-,root,root,-)
%doc CONTRIBUTING.md COPYING.md README.md
%{_bindir}/jupyter
%{_bindir}/jupyter2
%{_bindir}/jupyter-%{py_ver}
%ghost %{_sysconfdir}/alternatives/jupyter
%{_bindir}/jupyter-migrate
%{_bindir}/jupyter2-migrate
%{_bindir}/jupyter-migrate-%{py_ver}
%ghost %{_sysconfdir}/alternatives/jupyter-migrate
%{python_sitelib}/*
%changelog