Blob Blame History Raw
%global pypi_name qtconsole

Name:		python-%{pypi_name}
Version:	4.2.1
Release:	7%{?dist}
Summary:	Jupyter Qt console

#license clarification issue opened with upstream
# https://github.com/jupyter/qtconsole/issues/142
License:	BSD

URL:		http://jupyter.org
Source0:	https://files.pythonhosted.org/packages/source/q/%{pypi_name}/%{pypi_name}-%{version}.tar.gz
BuildArch:	noarch
 
BuildRequires:	python-setuptools
BuildRequires:	python2-devel
BuildRequires:	python-sphinx
BuildRequires:	python-ipython-sphinx
 
BuildRequires:	python3-setuptools
BuildRequires:	python3-devel
BuildRequires:	python3-ipython-sphinx

BuildRequires:	desktop-file-utils

%description
Qt-based console for Jupyter with support for rich media output

%package -n     python2-%{pypi_name}
Summary:	Jupyter Qt console
%{?python_provide:%python_provide python2-%{pypi_name}}

%if 0%{?fedora} > 25
Provides:	python2-ipython-gui = %{version}-%{release}
%{?python_provide:%python_provide python2-ipython-gui}
Obsoletes:	python2-ipython-gui < 4
%endif
 
Requires:	python-traitlets
Requires:	python-jupyter_core
Requires:	python-jupyter-client >= 4.1
Requires:	python-pygments
Requires:	python-ipykernel >= 4.1
Requires:	python-setuptools


%description -n python2-%{pypi_name}
Qt-based console for Jupyter with support for rich media output

%package -n     python3-%{pypi_name}
Summary:	Jupyter Qt console
%{?python_provide:%python_provide python3-%{pypi_name}}

%if 0%{?fedora} > 25
Provides:	python3-ipython-gui = %{version}-%{release}
%{?python_provide:%python_provide python3-ipython-gui}
Obsoletes:	python3-ipython-gui < 4
%endif
 
Requires:	python3-traitlets
Requires:	python3-jupyter_core
Requires:	python3-jupyter-client >= 4.1
Requires:	python3-pygments
Requires:	python3-ipykernel >= 4.1
Requires:	python3-setuptools


%description -n python3-%{pypi_name}
Qt-based console for Jupyter with support for rich media output

%package -n python-%{pypi_name}-doc
Summary:	Documentation subpackage for qtconsole

%description -n python-%{pypi_name}-doc
Documentation for qtconsole

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

# prepare desktop files
pushd examples
sed 's/jupyter qtconsole/jupyter-qtconsole-2/' jupyter-qtconsole.desktop > jupyter-qtconsole-2.desktop
sed 's/jupyter qtconsole/jupyter-qtconsole-3/' jupyter-qtconsole.desktop > jupyter-qtconsole-3.desktop
popd

%build
%py2_build
%py3_build

# generate html docs 
sphinx-build docs/source html

# fix file encoding and utf-8
sed -i 's/\r$//' html/objects.inv


# remove the sphinx-build leftovers
rm -rf html/.{doctrees,buildinfo}

%install
# Must do the subpackages' install first because the scripts in /usr/bin are
# overwritten with every setup.py install.
%py3_install
cp %{buildroot}/%{_bindir}/jupyter-qtconsole %{buildroot}/%{_bindir}/jupyter-qtconsole-3
ln -sf %{_bindir}/jupyter-qtconsole-3 %{buildroot}/%{_bindir}/jupyter-qtconsole-%{python3_version}
desktop-file-install --dir=%{buildroot}%{_datadir}/applications examples/jupyter-qtconsole-3.desktop

%py2_install
sed -i '1s=^#!/usr/bin/\(python\|env python\)[23]\?=#!%{__python2}=' %{buildroot}/%{_bindir}/jupyter-qtconsole
cp %{buildroot}/%{_bindir}/jupyter-qtconsole %{buildroot}/%{_bindir}/jupyter-qtconsole-2
ln -sf %{_bindir}/jupyter-qtconsole-2 %{buildroot}/%{_bindir}/jupyter-qtconsole-%{python2_version}
desktop-file-install --dir=%{buildroot}%{_datadir}/applications examples/jupyter-qtconsole-2.desktop

%files -n python2-%{pypi_name} 
%license COPYING.md
%doc README.md
%{_bindir}/jupyter-qtconsole
%{_bindir}/jupyter-qtconsole-2
%{_bindir}/jupyter-qtconsole-%{python2_version}
%{_datadir}/applications/jupyter-qtconsole-2.desktop
%{python2_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
%{python2_sitelib}/%{pypi_name}/*
%dir %{python2_sitelib}/%{pypi_name}/

%files -n python3-%{pypi_name} 
%license COPYING.md
%doc README.md
%{_bindir}/jupyter-qtconsole-3
%{_bindir}/jupyter-qtconsole-%{python3_version}
%{_datadir}/applications/jupyter-qtconsole-3.desktop
%{python3_sitelib}/%{pypi_name}-%{version}-py?.?.egg-info
%{python3_sitelib}/%{pypi_name}/*
%dir %{python3_sitelib}/%{pypi_name}/

%files -n python-%{pypi_name}-doc
%doc html 

%changelog
* Wed Mar 15 2017 Miro HronĨok <mhroncok@redhat.com> - 4.2.1-7
- Provide/Obsolete pythonX-ipython-gui

* Wed Feb 22 2017 Mukundan Ragavan <nonamedotc@fedoraproject.org> - 4.2.1-6
- Fix python dependencies (py2 sub-package does not req py3)

* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 4.2.1-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Sat Sep 24 2016 Mukundan Ragavan <nonamedotc@fedoraproject.org> - 4.2.1-4
- Removed scripts; F25+ only

* Sat Sep 24 2016 Mukundan Ragavan <nonamedotc@fedoraproject.org> - 4.2.1-3
- Added scripts for desktop database (fixes embarassing oversight!)

* Sat Sep 24 2016 Mukundan Ragavan <nonamedotc@fedoraproject.org> - 4.2.1-2
- Fix typos in description
- Fix typos in summary
- Add BR: desktop-file-utils
- Add desktop files

* Fri Aug 12 2016 Mukundan Ragavan <nonamedotc@gmail.com> - 4.2.1-1
- Initial package.