LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File python-jupyter_nbformat.spec of Package python-jupyter_nbformat (Project home:sbahling:Backports:jupyter)

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


Name:           python-jupyter_nbformat
Version:        4.0.1
Release:        0
Summary:        The Jupyter Notebook format
License:        BSD-3-Clause
Group:          Development/Languages/Python
Url:            http://jupyter.org
Source:         https://pypi.python.org/packages/source/n/nbformat/nbformat-%{version}.tar.gz
BuildRequires:  python-devel
BuildRequires:  python-ipython_genutils
BuildRequires:  python-jsonschema > 2.5.0
BuildRequires:  python-jupyter_core
BuildRequires:  python-setuptools
BuildRequires:  python-traitlets
# Test requirements
BuildRequires:  python-nose
# Documentation requirements
BuildRequires:  python-Sphinx
BuildRequires:  python-numpydoc
%if 0%{?suse_version} && ( 0%{?suse_version} != 1315 && 0%{?suse_version} > 1110 )
BuildRequires:  python-Sphinx-latex
%endif
Requires:       python-ipython_genutils
Requires:       python-jsonschema > 2.5.0
Requires:       python-jupyter_core
Requires:       python-traitlets
Requires(post): update-alternatives
Requires(postun): update-alternatives
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} && 0%{?suse_version} <= 1110
%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%else
BuildArch:      noarch
%endif

%description
This package contains the base implementation of the Jupyter Notebook format,
and Python APIs for working with notebooks.

%package doc-html
Summary:        HTML documentation for %{name}
Recommends:     %{name} = %{version}

%description doc-html
Documentation and help files for %{name} in HTML format

%package doc-pdf
Summary:        HTML documentation for %{name}
Recommends:     %{name} = %{version}

%description doc-pdf
Documentation and help files for %{name} in PDF format

%prep
%setup -q -n nbformat-%{version}

%build
python setup.py build

%install
python setup.py install --prefix=%{_prefix} --root=%{buildroot}
mv %{buildroot}%{_bindir}/jupyter-trust %{buildroot}%{_bindir}/jupyter2-trust
ln -s -f %{_bindir}/jupyter2-trust %{buildroot}%{_bindir}/jupyter-trust-%{py_ver}

# Prepare for update-alternatives usage
mkdir -p %{buildroot}%{_sysconfdir}/alternatives
ln -s -f %{_sysconfdir}/alternatives/jupyter-trust %{buildroot}%{_bindir}/jupyter-trust
# create a dummy target for /etc/alternatives/jupyter-trust
touch %{buildroot}%{_sysconfdir}/alternatives/jupyter-trust

# Build the documentation
pushd docs
%if 0%{?suse_version} && ( 0%{?suse_version} != 1315 && 0%{?suse_version} > 1110 )
PYTHONPATH=%{buildroot}%{python_sitelib} make latexpdf
%endif
PYTHONPATH=%{buildroot}%{python_sitelib} make html
rm -rf _build/html/.buildinfo
popd

%post
%_sbindir/update-alternatives \
   --install %{_bindir}/jupyter-trust jupyter-trust %{_bindir}/jupyter-trust-%{py_ver} 30

%postun
if [ $1 -eq 0 ] ; then
    %_sbindir/update-alternatives --remove jupyter-trust %{_bindir}/jupyter-trust-%{py_ver}
fi

%check
nosetests

%files
%defattr(-,root,root,-)
%doc COPYING.md README.md
%{_bindir}/jupyter-trust
%{_bindir}/jupyter2-trust
%{_bindir}/jupyter-trust-%{py_ver}
%ghost %{_sysconfdir}/alternatives/jupyter-trust
%{python_sitelib}/*

%files doc-html
%defattr(-,root,root,-)
%doc COPYING.md
%doc docs/_build/html/

%if 0%{?suse_version} && ( 0%{?suse_version} != 1315 && 0%{?suse_version} > 1110 )
%files doc-pdf
%defattr(-,root,root,-)
%doc COPYING.md
%doc docs/_build/latex/*.pdf
%endif

%changelog