File python-jupyter_qtconsole.spec of Package python-jupyter_qtconsole

#
# spec file for package python-jupyter_qtconsole
#
# Copyright (c) 2018 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/
#


%{?!python_module:%define python_module() python-%{**} python3-%{**}}
Name:           python-jupyter_qtconsole
Version:        4.4.3
Release:        0
Summary:        Jupyter Qt console
License:        BSD-3-Clause
Group:          Development/Languages/Python
Url:            https://github.com/jupyter/qtconsole
Source0:        https://files.pythonhosted.org/packages/source/q/qtconsole/qtconsole-%{version}.tar.gz
Source1:        https://media.readthedocs.org/pdf/qtconsole/%{version}/qtconsole.pdf
Source2:        https://media.readthedocs.org/htmlzip/qtconsole/%{version}/qtconsole.zip
BuildRequires:  %{python_module devel}
BuildRequires:  %{python_module jupyter_core}
BuildRequires:  %{python_module setuptools}
BuildRequires:  desktop-file-utils
BuildRequires:  fdupes
BuildRequires:  hicolor-icon-theme
BuildRequires:  python-rpm-macros
BuildRequires:  unzip
BuildRequires:  update-desktop-files
# SECTION test requirements
BuildRequires:  %{python_module Pygments}
BuildRequires:  %{python_module ipython_genutils}
BuildRequires:  %{python_module jupyter_client >= 4.1}
BuildRequires:  %{python_module jupyter_core}
BuildRequires:  %{python_module jupyter_ipykernel >= 4.1}
BuildRequires:  %{python_module nose}
BuildRequires:  %{python_module pexpect}
BuildRequires:  %{python_module pytest}
BuildRequires:  %{python_module qt5}
BuildRequires:  %{python_module sip}
BuildRequires:  %{python_module traitlets}
# /SECTION
Requires:       hicolor-icon-theme
Requires:       python-Pygments
Requires:       python-ipython_genutils 
Requires:       python-jupyter_client >= 4.1
Requires:       python-jupyter_core
Requires:       python-jupyter_ipykernel >= 4.1
Requires:       python-sip
Requires:       python-traitlets
BuildArch:      noarch

%python_subpackages

%description
A rich Qt-based console for working with Jupyter kernels,
supporting rich media output, session export, and more.

%package     -n python-jupyter_qtconsole-doc
Summary:        Documentation for python-jupyter_qtconsole
Group:          Documentation/Other
Provides:       %{python_module jupyter_qtconsole-doc = %{version}}

%description -n python-jupyter_qtconsole-doc
Documentation and help files for python-jupyter_qtconsole.

%prep
%setup -q -n qtconsole-%{version}
cp %{SOURCE1} .
unzip %{SOURCE2} -d docs
mv docs/qtconsole-* docs/html
rm docs/html/.buildinfo

%build
%python_build

%install
export LANG=en_US.UTF-8
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}

# Install icon
mkdir -p %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/
cp qtconsole/resources/icon/JupyterConsole.svg %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/JupyterQtConsole.svg

# Modify and install .desktop file
pushd examples
desktop-file-edit --set-icon="JupyterQtConsole" jupyter-qtconsole.desktop
%suse_update_desktop_file -i -r jupyter-qtconsole "System;TerminalEmulator;"
popd

%check
rm -rf build
rm -rf _build.*
%{python_expand rm -rf build
rm -rf _build.*
pytest-%{$python_bin_suffix}
}

%files %{python_files}
%doc README.md
%license LICENSE
%python3_only %{_bindir}/jupyter-qtconsole
%python3_only %{_datadir}/applications/jupyter-qtconsole.desktop
%python3_only %{_datadir}/icons/hicolor/scalable/apps/JupyterQtConsole.svg
%{python_sitelib}/*

%files -n python-jupyter_qtconsole-doc
%license LICENSE
%doc qtconsole.pdf
%doc docs/html

%changelog
openSUSE Build Service is sponsored by