File python-jupyter_vega.spec of Package python-jupyter_vega
#
# spec file for package python-jupyter_vega
#
# 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_without test
Name: python-jupyter_vega
Version: 1.4.0
Release: 0
Summary: An IPython/Jupyter widget for Vega 3 and Vega-Lite 2
License: BSD-3-Clause
Group: Development/Languages/Python
Url: http://github.com/vega/ipyvega/
Source: https://files.pythonhosted.org/packages/source/v/vega/vega-%{version}.tar.gz
BuildRequires: %{python_module devel}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
BuildRequires: python3-jupyter_client >= 4.2
BuildRequires: python3-jupyter_notebook
%if %{with test}
BuildRequires: %{python_module jupyter_ipython}
BuildRequires: %{python_module numpy}
BuildRequires: %{python_module pandas}
BuildRequires: %{python_module pytest}
%endif
Requires: python-jupyter_ipython
%ifpython2
Recommends: python-jupyter_notebook
Requires: python3-jupyter_vega
%endif
%ifpython3
Requires(post): python3-jupyter_notebook
Requires(preun): python3-jupyter_notebook
%endif
BuildArch: noarch
%python_subpackages
%description
IPython/Jupyter notebook module for Vega and Vega-Lite,
Polestar, and Voyager. Notebooks with embedded visualizations
can be viewed on github and nbviewer.
For more information, see https://github.com/vega/ipyvega/.
%prep
%setup -q -n vega-%{version}
rm -rf vega/.ipynb_checkpoints
%build
%python_build
%install
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
export PYTHONPATH=%{buildroot}%{python3_sitelib}
jupyter nbextension install --py --prefix %{buildroot}%{_prefix} vega
if [ $(dirname %{_prefix}/etc/jupyter) != $(dirname %{_sysconfdir}/jupyter) ]; then
mkdir -p %{buildroot}%{_sysconfdir}
mv %{buildroot}%{_prefix}/etc/jupyter %{buildroot}%{_sysconfdir}/jupyter
rm -d %{buildroot}%{_prefix}/etc
fi
%{fdupes %{buildroot}%{_datadir}/jupyter/ %{buildroot}%{python3_sitelib}}
%post -n python3-jupyter_vega
jupyter nbextension enable --py --system vega || true
%preun -n python3-jupyter_vega
if [ "$1" = 0 ] && [ -d %{python3_sitelib}/vega/ ] ; then
jupyter nbextension disable --py --system vega || true
fi
%if %{with test}
%check
%python_expand py.test-%{$python_bin_suffix} vega
%endif
%files %{python_files}
%defattr(-,root,root,-)
%doc README.md
%license LICENSE
%{python_sitelib}/vega/
%{python_sitelib}/vega-%{version}-py*.egg-info
%python3_only %{_datadir}/jupyter/nbextensions/jupyter-vega/
%python3_only %config %{_sysconfdir}/jupyter/nbconfig/notebook.d/vega.json
%changelog