Blob Blame History Raw
%bcond_without check
%bcond_without doc
%global pypi_name ipython

Name:           python2-ipython
Version:        5.5.0
Release:        2%{?dist}
Summary:        An enhanced interactive Python shell

License:        BSD
URL:            http://ipython.org/
Source0:        https://files.pythonhosted.org/packages/source/i/ipython/ipython-%{version}.tar.gz

BuildArch:      noarch

%{?python_provide:%python_provide %{name}}
Provides:       ipython2 = %{version}-%{release}
Provides:       %{name}-console = %{version}-%{release}
Provides:       python-ipython-console = %{version}-%{release}
Provides:       %{pypi_name} = %{version}-%{release}
Obsoletes:      %{name}-console < 5.3.0-1
Obsoletes:      %{pypi_name} < 5.3.0-4

BuildRequires:  python2-devel
BuildRequires:  python2-decorator
BuildRequires:  python2-jsonschema
BuildRequires:  python2-path
BuildRequires:  python2-pexpect
BuildRequires:  python2-simplegeneric
BuildRequires:  python2-pickleshare
BuildRequires:  python2-mistune >= 0.3.1
BuildRequires:  python2-traitlets >= 4.2
BuildRequires:  python2-prompt_toolkit

Requires:       python2-zmq
Requires:       python2-backports-shutil_get_terminal_size
Requires:       python2-zmq
Requires:       python2-pathlib
Requires:       python2-decorator
Requires:       python2-mistune >= 0.3.1
Requires:       python2-jsonschema
Requires:       python2-path
Requires:       python2-pexpect
Requires:       python2-simplegeneric
Requires:       python2-traitlets >= 4.2
Requires:       python2-prompt_toolkit
Requires:       python2-pickleshare
Requires:       python2-setuptools

%if %{with doc}
BuildRequires:  python2-sphinx
%endif

%if %{with check}
# for checking/testing
BuildRequires:  python2-Cython
BuildRequires:  python2-nose
BuildRequires:  python2-matplotlib
BuildRequires:  python2-mock
BuildRequires:  python2-pymongo
BuildRequires:  python2-requests
BuildRequires:  python2-zmq
BuildRequires:  python2-zmq-tests
BuildRequires:  python2-pathlib
BuildRequires:  python2-backports-shutil_get_terminal_size
BuildRequires:  python2-nbformat
BuildRequires:  python2-pytest
BuildRequires:  python2-ipykernel
BuildRequires:  python2-jupyter-client
BuildRequires:  python2-testpath
# for frontend
BuildRequires:  python2-pygments
# for running qt/matplotlib tests
BuildRequires:  xorg-x11-server-Xvfb
%endif # with check


%global ipython_desc_base \
IPython provides a replacement for the interactive Python interpreter with\
extra functionality.\
\
Main features:\
 * Comprehensive object introspection.\
 * Input history, 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.

%description
%{ipython_desc_base}

This package provides IPython for a terminal.


%package sphinx
Summary:        Sphinx directive to support embedded IPython code
%{?python_provide:%python_provide %{name}-sphinx}
Requires:       %{name} = %{version}-%{release}
BuildRequires:  python2-sphinx
Requires:       python2-sphinx
%description sphinx
%{ipython_desc_base}

This package contains the ipython sphinx extension.


%package tests
Summary:        Tests for %{name}
%{?python_provide:%python_provide %{name}-tests}
Requires:       python2-nose
Requires:       python2-zmq-tests
Requires:       %{name} = %{version}-%{release}
Requires:       python2-nbformat
Requires:       python2-pytest
Requires:       python2-ipykernel
Requires:       python2-jupyter-client
Requires:       python2-testpath
%description tests
This package contains the tests of %{name}.
You can check this way, if ipython works on your platform.


%if %{with doc}
%package doc
Summary:        Documentation for %{name}
License:        CC-BY
%{?python_provide:%python_provide %{name}-doc}
Provides:       ipython-doc = %{version}-%{release}
%description doc
This package contains the documentation of %{name}.
%endif

%prep
%autosetup -p1 -n %{pypi_name}-%{version}

# delete bundling libs
pushd IPython/external
ls -l
ls -l *

# use decorators of numpy
rm decorators/_decorators.py

popd

# Remove shebangs
sed -i '1d' $(grep -lr '^#!/usr/' IPython)

%build
%py2_build

%if %{with doc}
pushd docs
PYTHONPATH=.. make html PYTHON=%{__python2} SPHINXBUILD=sphinx-build-2
mkdir -p build/html/
rm -rf build/html/.buildinfo
# Do not bundle fonts
rm -rf build/html/_static/fonts/
popd
%endif


%install
%py2_install

# Do we need to replace python3 with python2? Only seems to occur on rawhide, see #1123618
echo %{buildroot}%{_bindir}/{iptest,ipython} | xargs head -n 2
echo %{buildroot}%{_bindir}/{iptest,ipython} | xargs sed -i '1s|^#!%{__python3}|#!%{__python2}|'


%if %{with check}
%check
%global test_groups extensions lib testing terminal utils nbformat core autoreload

# Ensure that the user's .pythonrc.py is not invoked during any tests.
export PYTHONSTARTUP=""
mkdir -p run_tests
pushd run_tests
    PYTHONPATH=%{buildroot}%{python2_sitelib} \
        PATH="%{buildroot}%{_bindir}:$PATH" \
        LC_ALL=en_US.UTF-8 \
        xvfb-run \
        %{buildroot}%{_bindir}/iptest2 %{test_groups}
popd
%endif

%files
%license COPYING.rst
%{_bindir}/ipython
%{_bindir}/ipython2
%{_mandir}/man*/ipython.*

%dir %{python2_sitelib}/IPython
%{python2_sitelib}/IPython/external
%{python2_sitelib}/IPython/*.py*
%dir %{python2_sitelib}/IPython/kernel
%{python2_sitelib}/IPython/kernel/*.py*
%dir %{python2_sitelib}/IPython/testing
%{python2_sitelib}/IPython/testing/*.py*
%{python2_sitelib}/IPython/testing/plugin
%{python2_sitelib}/ipython-%{version}-py?.?.egg-info

%{python2_sitelib}/IPython/core/
%{python2_sitelib}/IPython/extensions/
%{python2_sitelib}/IPython/lib/
%{python2_sitelib}/IPython/terminal/
%{python2_sitelib}/IPython/utils/

# tests go into subpackage
%exclude %{python2_sitelib}/IPython/*/tests/


%files sphinx
%license COPYING.rst
%{python2_sitelib}/IPython/sphinxext/


%files tests
%license COPYING.rst
%{_bindir}/iptest
%{_bindir}/iptest2
%{python2_sitelib}/IPython/*/tests


%if %{with doc}
%files doc
%license COPYING.rst
%doc docs/build/html
%endif

%changelog
* Fri Dec 08 2017 Iryna Shcherbina <ishcherb@redhat.com> - 5.5.0-2
- Fix ambiguous Python 2 dependency declarations
  (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)

* Sat Sep 30 2017 Lumir Balhar <lbalhar@redhat.com> - 5.5.0-1
- New upstream release

* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 5.4.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Thu Jun 1 2017 Lumir Balhar <lbalhar@redhat.com> - 5.4.0-1
- New upstream release
- Remove patch for already fixed bug

* Fri May 12 2017 Lumir Balhar <lbalhar@redhat.com> - 5.3.0-7
- Fix missing requires bug (RHBZ#1450288)

* Fri May 12 2017 Lumir Balhar <lbalhar@redhat.com> - 5.3.0-6
- Bootstraping done - enable tests and docs subpackage

* Fri Apr 21 2017 Lumír Balhar <lbalhar@redhat.com> - 5.3.0-5
- Initial package split from original ipython package
- Bootstraping - step 1 - disable tests and docs subpackage