File python3-IPython.spec of Package python3-IPython

#
# spec file for package python3-IPython
#
# 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:           python3-IPython
Version:        3.2.2
Release:        0
Source0:        https://pypi.python.org/packages/source/i/ipython/ipython-%{version}.tar.gz
Source1:        ipython3-icons.tar.xz
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Url:            http://ipython.scipy.org/
Summary:        An Enhanced Interactive Python Shell
License:        BSD-3-Clause
Group:          Development/Languages/Python
BuildArch:      noarch
BuildRequires:  python3
BuildRequires:  python3-2to3
BuildRequires:  python3-Cython
BuildRequires:  python3-curses
BuildRequires:  python3-devel
BuildRequires:  python3-nose >= 0.10.1
BuildRequires:  python3-opengl
BuildRequires:  python3-pexpect
BuildRequires:  python3-pymongo
BuildRequires:  python3-pyzmq-devel >= 2.1.11
BuildRequires:  python3-setuptools
BuildRequires:  python3-xml
%if 0%{?suse_version}
BuildRequires:  fdupes
BuildRequires:  update-desktop-files
%endif
Requires:       python3-Jinja2
Requires:       python3-pexpect
Requires:       python3-pyzmq >= 2.1.11
Requires:       python3-tk
Requires:       python3-xml
Recommends:     python3-curses
Recommends:     python3-pymongo
# not available yet upstream
#Recommends:       python3-wxWidgets
# qtconsole
BuildRequires:  python3-Pygments
BuildRequires:  python3-matplotlib
BuildRequires:  python3-qt4-devel
Recommends:     python3-Pygments
Recommends:     python3-matplotlib
Recommends:     python3-qt4
#ipython notebook
BuildRequires:  python3-tornado >= 4.0
Recommends:     python3-tornado >= 4.0
BuildRequires:  python3-mistune >= 0.5
Recommends:     python3-mistune >= 0.5
#ipython nbformat
BuildRequires:  python3-jsonschema
Requires:       python3-jsonschema
#documentation
BuildRequires:  graphviz
BuildRequires:  graphviz-gnome
BuildRequires:  python3-Sphinx >= 0.3
BuildRequires:  python3-numpydoc

%description
IPython provides a replacement for the interactive python (Python)
interpreter with extra functionality.

Main features:
* Comprehensive object introspection.
* Input history that is persistent across sessions.
* Caching of output results during a session with automatically
   generated references.
* Readline-based name completion.
* Extensible system of 'magic' commands for controlling the
   environment and performing many tasks related either to IPython
   or the operating system.
* 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.
* Integrated access to the pdb debugger and the Python profiler.


%package doc
Summary:        An Enhanced Interactive Python Shell documentation
Group:          Documentation/Other
Recommends:     %{name} = %{version}

%description doc
IPython provides a replacement for the interactive python (Python)
interpreter with extra functionality.

This package contains comprehensive documentation for IPython in
html format, as well as examples of usage.

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

# Get rid of library shebangs
find . -type f -name "*.py" -exec sed -i '/#!\/usr\/bin\/env/d' {} \;

%build
export CFLAGS="%{optflags}"
python3 setup.py build

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

# move automatically installed documentation to the right directory
install -d -m 755 %{buildroot}%{_docdir}/
#mv -f %{buildroot}/usr/share/doc/IPython/ %{buildroot}%{_docdir}/%{name}

# does not seem to work with python 3
#make docs
#pushd docs
#sed -i 's/python/python3/g' Makefile
#2to3 -w ./
#PYTHONPATH=$PYTHONPATH:%{buildroot}%{python3_sitelib} make html
#rm build/html/.buildinfo
#mv build/html %{buildroot}%{_docdir}/%{name}/
#popd

# Fix man pages
for i in %{buildroot}%{_mandir}/man1/*; do mv "$i" "${i%%.1}3.1"; done

# remove hidden files
rm -f %{buildroot}/%{python3_sitelib}/IPython/.git_commit_info.ini
rm -f %{buildroot}/%{_docdir}/%{name}/manual/.buildinfo

# remove all executables that don't follow the bin/*3 convention for python3
rm %{buildroot}/%{_bindir}/ipcluster
rm %{buildroot}/%{_bindir}/ipcontroller
rm %{buildroot}/%{_bindir}/ipengine
rm %{buildroot}/%{_bindir}/iptest
rm %{buildroot}/%{_bindir}/ipython

# Fix .desktop files for python 3
mv examples/IPython\ Kernel/ipython.desktop  ./ipython3.desktop
mv examples/IPython\ Kernel/ipython-qtconsole.desktop ./ipython3-qtconsole.desktop

sed -i 's/Python/Python 3/g' *.desktop
sed -i 's/ipython/ipython3/g' *.desktop
sed -i 's/Pylab/Pylab3/g' *.desktop

%if 0%{?suse_version}
%fdupes %{buildroot}/%{_docdir}

# install .desktop files
sed -i 's/gnome-netstatus-idle/ipython3/g' *.desktop
%suse_update_desktop_file -r -i ipython3 System TerminalEmulator
%suse_update_desktop_file -r -i ipython3-qtconsole System TerminalEmulator
%endif

# install icons
tar xf %{S:1} -C %{buildroot}%{_datadir}

%files
%defattr(-,root,root)
%doc COPYING.rst README.rst
%{_bindir}/ipcluster3
%{_bindir}/ipcontroller3
%{_bindir}/ipengine3
%{_bindir}/iptest3
%{_bindir}/ipython3
%{_mandir}/man1/ipcluster3.1.gz
%{_mandir}/man1/ipcontroller3.1.gz
%{_mandir}/man1/ipengine3.1.gz
%{_mandir}/man1/ipython3.1.gz
%{_datadir}/applications/ipython3-qtconsole.desktop
%{_datadir}/applications/ipython3.desktop
%{_datadir}/icons/hicolor/
%{python3_sitelib}/IPython
%{python3_sitelib}/ipython-%{version}-py*.egg-info

%files doc
%defattr(-,root,root)
%doc %{_docdir}/%{name}
%exclude %{_docdir}/%{name}/COPYING.rst
%exclude %{_docdir}/%{name}/README.rst

%changelog