File python2-jupyter_ipython.spec of Package python2-jupyter_ipython
#
# spec file for package python2-jupyter_ipython
#
# Copyright (c) 2019 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 https://bugs.opensuse.org/
#
%bcond_without iptest
%define oldpython python
Name: python2-jupyter_ipython
Version: 5.8.0
Release: 0
Summary: Rich architecture for interactive computing with Python
License: BSD-3-Clause
Group: Development/Languages/Python
Url: https://github.com/ipython/ipython
Source: https://files.pythonhosted.org/packages/source/i/ipython/ipython-%{version}.tar.gz
Source1: https://raw.githubusercontent.com/jupyter/qtconsole/4.0.0/qtconsole/resources/icon/JupyterConsole.svg
BuildRequires: desktop-file-utils
BuildRequires: fdupes
BuildRequires: hicolor-icon-theme
BuildRequires: python-devel
BuildRequires: python-setuptools
BuildRequires: update-desktop-files
%if %{with iptest}
BuildRequires: python-backports.shutil_get_terminal_size
BuildRequires: python-decorator
BuildRequires: python-jupyter_nbformat
BuildRequires: python-matplotlib
BuildRequires: python-mock
BuildRequires: python-nose
BuildRequires: python-pathlib2
BuildRequires: python-pexpect
BuildRequires: python-pickleshare
BuildRequires: python-prompt_toolkit1 >= 1.0.4
BuildRequires: python-requests
BuildRequires: python-simplegeneric > 0.8
BuildRequires: python-testpath
BuildRequires: python-traitlets
%endif
%if %{with ico}
BuildRequires: icoutils
%endif
Requires: python-Pygments
Requires: python-backports.shutil_get_terminal_size
Requires: python-decorator
Requires: python-jedi >= 0.10
Requires: python-pathlib2
Requires: python-pexpect
Requires: python-pickleshare
Requires: python-prompt_toolkit1 >= 1.0.4
Requires: python-simplegeneric > 0.8
Requires: python-traitlets >= 4.2
Requires: python-typing
Recommends: python-docrepr
Recommends: python-jupyter_ipykernel
Recommends: python-jupyter_ipyparallel
Recommends: python-jupyter_ipywidgets
Recommends: python-jupyter_nbconvert
Recommends: python-jupyter_nbformat
Recommends: python-jupyter_notebook
Recommends: python-jupyter_qtconsole
Provides: IPython = %{version}
Obsoletes: IPython < %{version}
Provides: python-IPython = %{version}
Obsoletes: python-IPython < %{version}
Provides: %{oldpython}-IPython = %{version}
Provides: %{oldpython}-IPython = %{version}
Provides: %{oldpython}-jupyter_ipython = %{version}
Obsoletes: %{oldpython}-jupyter_ipython < %{version}
Requires(post): update-alternatives
Requires(postun): update-alternatives
BuildArch: noarch
%description
IPython provides a rich toolkit to help you make the
most out of using Python interactively. Its main
components are:
* A powerful interactive Python shell
* A Jupyter kernel to work with Python code in
Jupyter notebooks and other interactive frontends.
The enhanced interactive Python shells have the
following main features:
* Comprehensive object introspection.
* Input history, persistent across sessions.
* Caching of output results during a session with automatically
generated references.
* Extensible tab completion, with support by default for completion
of python variables and keywords, filenames and function keywords.
* Extensible system of ‘magic’ commands for controlling the
environment and performing many tasks related either to IPython or
the operating system.
* A rich configuration system with easy switching between different
setups (simpler than changing $PYTHONSTARTUP environment variables
every time).
* Session logging and reloading.
* Extensible syntax processing for special purpose situations.
* Access to the system shell with user-extensible alias system.
* Easily embeddable in other Python programs and GUIs.
* Integrated access to the pdb debugger and the Python profiler.
IMPORTANT: The Python 2 version of IPython is in long-term support
mode. It will not be receiving major new features. Starting with
IPython 6, only Python 3.3 and later is supported.
%package iptest
Summary: Tools for testing packages that rely in %{name}
Group: Development/Languages/Python
Requires: %{name} = %{version}
Requires: python-matplotlib
Requires: python-nose
Requires: python-requests
Requires: python-testpath
# Python 2 Test Requirements
Requires: python-mock
Provides: python-jupyter_ipython-iptest = %{version}
Obsoletes: python-jupyter_ipython-iptest < %{version}
%description iptest
This package provides the iptest command, which is used for
testing software that uses %{name}.
IMPORTANT: The Python 2 version of IPython is in long-term support
mode. It will not be receiving major new features. Starting with
IPython 6, only Python 3.3 and later is supported.
%prep
%setup -q -n ipython-%{version}
sed -i "s|#!/usr/bin/env python|#!/usr/bin/python|" IPython/testing/plugin/iptest.py
sed -i "s|#!/usr/bin/env python|#!/usr/bin/python|" IPython/testing/plugin/setup.py
sed -i "s|#!/usr/bin/env python|#!/usr/bin/python|" IPython/terminal/ipapp.py
find . -type f -name "*.py" -exec sed -i "s|#!/usr/bin/python|#!/usr/bin/python2|" {} \;
%build
python setup.py build
%if %{with ico}
pushd scripts
icotool -x ipython.ico
icotool -x ipython_nb.ico
popd
%endif
%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
# Prepare for update-alternatives usage
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
for p in ipython iptest ; do
sed -i "s|#!/usr/bin/python|#!/usr/bin/python2|" %{buildroot}%{_bindir}/${p}
sed -i "s|#!/usr/bin/python|#!/usr/bin/python2|" %{buildroot}%{_bindir}/${p}2
mv %{buildroot}%{_bindir}/$p %{buildroot}%{_bindir}/$p-%{py_ver}
ln -s -f %{_sysconfdir}/alternatives/$p %{buildroot}%{_bindir}/$p
# create a dummy target for /etc/alternatives/$p
touch %{buildroot}%{_sysconfdir}/alternatives/$p
done
mv %{buildroot}%{_mandir}/man1/ipython.1 %{buildroot}%{_mandir}/man1/ipython-%{py_ver}.1
ln -s -f %{_sysconfdir}/alternatives/ipython.1.gz %{buildroot}%{_mandir}/man1/ipython.1.gz
# create a dummy target for /etc/alternatives/ipython.1.gz
touch %{buildroot}%{_sysconfdir}/alternatives/ipython.1.gz
# We also want a manual for ipython2
ln -s %{_mandir}/man1/ipython-%{py_ver}.1.gz %{buildroot}%{_mandir}/man1/ipython2.1.gz
# These can be run stand-alone, so make them executable rather than removing shebang
chmod a+x %{buildroot}%{python_sitelib}/IPython/external/mathjax.py
chmod a+x %{buildroot}%{python_sitelib}/IPython/testing/plugin/iptest.py
chmod a+x %{buildroot}%{python_sitelib}/IPython/testing/plugin/setup.py
chmod a+x %{buildroot}%{python_sitelib}/IPython/terminal/ipapp.py
mkdir -p %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/
cp %{SOURCE1} %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/IPython-%{py_ver}.svg
%if %{with ico}
# Install the icons
for x in 16 24 32 48 256 ; do
mkdir -p %{buildroot}%{_datadir}/icons/hicolor/${x}x${x}/apps/
ipyf=(scripts/ipython_*_${x}x${x}x32.png)
ipynbf=(scripts/ipython_nb_*_${x}x${x}x32.png)
cp ${ipyf[0]} %{buildroot}%{_datadir}/icons/hicolor/${x}x${x}/apps/IPython-%{py_ver}.png
cp ${ipynbf[0]} %{buildroot}%{_datadir}/icons/hicolor/${x}x${x}/apps/IPythonNotebook-%{py_ver}.png
done
%endif
# Modify and install .desktop file
mv examples/IPython\ Kernel/ipython.desktop ipython-%{py_ver}.desktop
desktop-file-edit --set-comment="Enhanced interactive Python %{py_ver} shell" --set-name="ipython %{py_ver}" --set-generic-name="IPython %{py_ver}" --set-key="Exec" --set-value="ipython-%{py_ver}" --set-icon="IPython-%{py_ver}" ipython-%{py_ver}.desktop
%suse_update_desktop_file -i -r ipython-%{python_version} "System;TerminalEmulator;"
rm %{buildroot}%{_bindir}/ipython2
ln -s %{_bindir}/ipython-%{py_ver} %{buildroot}%{_bindir}/ipython2
# Remove these since they won't work
%if !%{with iptest}
rm %{buildroot}%{_bindir}/iptest
rm %{buildroot}%{_bindir}/iptest2
rm %{buildroot}%{_bindir}/iptest-%{py_ver}
rm %{buildroot}%{_sysconfdir}/alternatives/iptest
%else
rm %{buildroot}%{_bindir}/iptest2
ln -s %{_bindir}/iptest-%{py_ver} %{buildroot}%{_bindir}/iptest2
%endif
%post
%_sbindir/update-alternatives \
--install %{_bindir}/ipython ipython %{_bindir}/ipython-%{py_ver} 30 \
--slave %{_mandir}/man1/ipython.1.gz ipython.1.gz %{_mandir}/man1/ipython-%{py_ver}.1.gz
%desktop_database_post
%icon_theme_cache_post
%post iptest
%_sbindir/update-alternatives \
--install %{_bindir}/iptest iptest %{_bindir}/iptest-%{py_ver} 30
%postun
if [ $1 -eq 0 ] ; then
%_sbindir/update-alternatives --remove ipython %{_bindir}/ipython-%{py_ver}
fi
%desktop_database_postun
%icon_theme_cache_postun
%postun iptest
if [ $1 -eq 0 ] ; then
%_sbindir/update-alternatives --remove iptest %{_bindir}/iptest-%{py_ver}
fi
%files
%doc README.rst
%license COPYING.rst docs/source/about/license_and_copyright.rst
%{_bindir}/ipython
%{_bindir}/ipython2
%{_bindir}/ipython-%{py_ver}
%ghost %{_sysconfdir}/alternatives/ipython
%{_mandir}/man1/ipython.1.gz
%{_mandir}/man1/ipython-%{py_ver}.1.gz
%{_mandir}/man1/ipython2.1.gz
%ghost %{_sysconfdir}/alternatives/ipython.1.gz
%{python_sitelib}/IPython/
%{python_sitelib}/ipython-%{version}-py*.egg-info
%{_datadir}/applications/ipython-%{py_ver}.desktop
%{_datadir}/icons/hicolor/scalable/apps/IPython-%{py_ver}.svg
%if %{with ico}
%{_datadir}/icons/hicolor/*x*/apps/IPython-%{py_ver}.png
%{_datadir}/icons/hicolor/*x*/apps/IPythonNotebook-%{py_ver}.png
%endif
%if %{with iptest}
%files iptest
%doc README.rst
%license COPYING.rst docs/source/about/license_and_copyright.rst
%{_bindir}/iptest
%{_bindir}/iptest2
%{_bindir}/iptest-%{py_ver}
%ghost %{_sysconfdir}/alternatives/iptest
%endif
%changelog