File python-jupyter_qgrid.spec of Package python-jupyter_qgrid
#
# spec file for package python-jupyter_qgrid
#
# 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-%{**}}
%bcond_with test
Name: python-jupyter_qgrid
Version: 1.1.1
Release: 0
Summary: Grid for sorting and filtering DataFrames in Jupyter notebooks
License: Apache-2.0
Group: Development/Languages/Python
Url: https://github.com/quantopian/qgrid
Source: https://files.pythonhosted.org/packages/source/q/qgrid/qgrid-%{version}.tar.gz
BuildRequires: %{python_module devel}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
BuildRequires: python3-jupyter_ipywidgets >= 7.0.0
BuildRequires: python3-jupyter_notebook >= 4.0.0
BuildRequires: python3-pandas >= 0.18.0
%if %{with test}
BuildRequires: %{python_module jupyter_ipywidgets >= 7.0.0}
BuildRequires: %{python_module jupyter_notebook >= 4.0.0}
BuildRequires: %{python_module pandas >= 0.18.0}
BuildRequires: %{python_module pytest}
%endif
Requires: python-jupyter_ipywidgets >= 7.0.0
Requires: python-jupyter_notebook >= 4.0.0
Requires: python-pandas >= 0.18.0
Provides: python-qgrid = %{version}
Obsoletes: python-qgrid < %{version}
%ifpython3
Requires(post): python-jupyter_ipywidgets >= 7.0.0
Requires(post): python-jupyter_notebook >= 4.0.0
Requires(post): python-pandas >= 0.18.0
Requires(preun): python-jupyter_ipywidgets >= 7.0.0
Requires(preun): python-jupyter_notebook >= 4.0.0
Requires(preun): python-pandas >= 0.18.0
%endif
%ifpython2
Requires: python3-jupyter_qgrid = %{version}
%endif
BuildArch: noarch
%python_subpackages
%description
An Interactive Grid for Sorting and Filtering DataFrames in Jupyter Notebook.
%prep
%setup -q -n qgrid-%{version}
%build
%python_build
%install
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%fdupes %{buildroot}%{_datadir}/jupyter/nbextensions/
%{python_expand $python -m compileall -d %{$python_sitelib} %{buildroot}%{$python_sitelib}/qgrid/tests/
$python -O -m compileall -d %{$python_sitelib} %{buildroot}%{$python_sitelib}/qgrid/tests/
}
%python_expand %fdupes %{buildroot}%{$python_sitelib}/qgrid/tests/
%post -n python3-jupyter_qgrid
jupyter nbextension enable --system --py qgrid || true
%preun -n python3-jupyter_qgrid
if [ $1 = 0 ] && [ -d %{python3_sitelib}/qgrid/ ] ; then
jupyter nbextension disable --system --py qgrid || true
fi
%if %{with test}
%check
export PYTHONDONTWRITEBYTECODE=1
%python_expand py.test-%{$python_bin_suffix} qgrid
%endif
%files %{python_files}
%defattr(-,root,root,-)
%doc README.rst
%license LICENSE
%{python_sitelib}/qgrid/
%{python_sitelib}/qgrid-%{version}-py*.egg-info
%python3_only %{_datadir}/jupyter/nbextensions/qgrid/
%changelog