File python-jupyter_wysiwyg.spec of Package python-jupyter_wysiwyg

#
# spec file for package python-jupyter_wysiwyg
#
# 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_wysiwyg
Version:        0.1.8
Release:        0
Summary:        WYSIWYG editing functionality for markdown/HTML cells in Jupyter
License:        BSD-3-Clause
Group:          Development/Languages/Python
Url:            https://github.com/genepattern/jupyter-wysiwyg/
Source:         https://files.pythonhosted.org/packages/source/j/jupyter-wysiwyg/jupyter-wysiwyg-%{version}.tar.gz
BuildRequires:  %{python_module devel}
BuildRequires:  %{python_module setuptools}
BuildRequires:  fdupes
BuildRequires:  python-rpm-macros
BuildRequires:  python3-jupyter_notebook
Requires:       python-jupyter_notebook
BuildArch:      noarch
%ifpython3
Requires(post):   python-jupyter_notebook
Requires(preun):  python-jupyter_notebook
%endif
%ifpython2
Requires:       python3-jupyter_wysiwyg = %{version}
%endif

%python_subpackages

%description
This is an nbextension that enables WYSIWYG editing functionality for
HTML/Markdown cells in Jupyter.

%prep
%setup -q -n jupyter-wysiwyg-%{version}
find . -name '.DS_Store' -delete

%build
%python_build

%install
%python_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}

PYTHONPATH=%{buildroot}%{python3_sitelib} jupyter nbextension install --nbextensions=%{buildroot}%{_datadir}/jupyter/nbextensions/ --py jupyter_wysiwyg
%python_expand %fdupes %{buildroot}%{_datadir}/jupyter/nbextensions/

%post -n python3-jupyter_wysiwyg
jupyter nbextension enable --system --py jupyter_wysiwyg || true

%preun -n python3-jupyter_wysiwyg
if [ $1 = 0 ] && [ -d %{python3_sitelib}/jupyter_wysiwyg/ ] ; then
    jupyter nbextension disable --system --py jupyter_wysiwyg || true
fi

%files %{python_files}
%defattr(-,root,root,-)
%license LICENSE.txt
%{python_sitelib}/jupyter_wysiwyg/
%{python_sitelib}/jupyter_wysiwyg-%{version}-py*.egg-info
%python3_only %{_datadir}/jupyter/nbextensions/jupyter_wysiwyg/

%changelog
openSUSE Build Service is sponsored by