File python-jupyter_latex_envs.spec of Package python-jupyter_latex_envs

#
# spec file for package python-jupyter_latex_envs
#
# 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_latex_envs
Version:        1.4.4
Release:        0
Summary:        LaTeX environments for Jupyter notebook
License:        BSD-3-Clause
Group:          Development/Languages/Python
Url:            http://github.com/jfbercher/jupyter_latex_envs
Source:         https://files.pythonhosted.org/packages/source/j/jupyter_latex_envs/jupyter_latex_envs-%{version}.tar.gz
BuildRequires:  %{python_module devel}
BuildRequires:  %{python_module setuptools}
BuildRequires:  fdupes
BuildRequires:  python-rpm-macros
BuildRequires:  python3-jupyter_notebook >= 4.0
%if %{with test}
BuildRequires:  %{python_module entrypoints >= 0.2.2}
BuildRequires:  %{python_module jupyter_core}
BuildRequires:  %{python_module jupyter_ipython}
BuildRequires:  %{python_module jupyter_nbconvert}
BuildRequires:  %{python_module jupyter_notebook >= 4.0}
BuildRequires:  %{python_module traitlets >= 4.1}
%endif
Requires:       python-jupyter_core
Requires:       python-jupyter_ipython
Requires:       python-jupyter_nbconvert
Requires:       python-jupyter_notebook >= 4.0
Requires:       python-traitlets >= 4.1
%ifpython3
Requires(post):   python-jupyter_notebook
Requires(preun):  python-jupyter_notebook
%endif
%ifpython2
Requires:       python3-jupyter_latex_envs = %{version}
%endif
BuildArch:      noarch

%python_subpackages

%description
Jupyter notebook extension which supports (some) LaTeX environments
within markdown cells. Also provides support for labels and
crossreferences, document wide numbering, bibliography, and more.

%prep
%setup -q -n jupyter_latex_envs-%{version}
rm -r src/latex_envs/static/doc/.ipynb_checkpoints
chmod a-x src/latex_envs/static/doc/IEEEtran.bst

%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 latex_envs
%python_expand %fdupes %{buildroot}%{_datadir}/jupyter/nbextensions/

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

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

%if %{with test}
%check
%python_exec setup.py test
%endif

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

%changelog
openSUSE Build Service is sponsored by