Blob Blame History Raw
%global pypi_name notebook

Name:           python-%{pypi_name}
%global _docdir_fmt %{name}

# Updating this package? Update the list of bundled things bellow (twice)
Version:        5.6.0

# a tag like rc1, set to %%{nil} if stable
%global tag %{nil}

# upstream version, like 1.2.3rc1
%global uversion %{version}%{tag}

Release:        2%{tag}%{?dist}
Summary:        A web-based notebook environment for interactive computing
License:        BSD
URL:            http://jupyter.org
Source0:        %pypi_source %{pypi_name} %{uversion}

# Patch to use the TeX fonts from the MathJax package rather than STIXWeb
# See BZ: 1581899, 1580129
Patch0:         0001-Use-MathJax-TeX-fonts-rather-than-STIXWeb.patch

BuildArch:      noarch

BuildRequires:  python2-setuptools
BuildRequires:  python2-devel

BuildRequires:  python3-setuptools
BuildRequires:  python3-devel

BuildRequires:  git-core

# rebuilding js and css
BuildRequires:  /usr/bin/node

# Tests:
BuildRequires:  pandoc

BuildRequires:  python3-dateutil
BuildRequires:  python3-ipykernel >= 4.8
BuildRequires:  python3-ipython_genutils
BuildRequires:  python3-jupyter-client >= 5.2.0
BuildRequires:  python3-jupyter-core >= 4.4.0
BuildRequires:  python3-nbconvert
BuildRequires:  python3-nbformat
BuildRequires:  python3-nose
BuildRequires:  python3-nose-exclude
BuildRequires:  python3-nose_warnings_filters
BuildRequires:  python3-pandocfilters
BuildRequires:  python3-prometheus_client
BuildRequires:  python3-send2trash
BuildRequires:  python3-terminado >= 0.8.1
BuildRequires:  python3-testpath
BuildRequires:  python3-tornado
BuildRequires:  python3-traitlets >= 4.2.1

BuildRequires:  python2-dateutil
BuildRequires:  python2-configparser
BuildRequires:  python2-ipykernel >= 4.8
BuildRequires:  python2-ipython_genutils
BuildRequires:  python2-jupyter-client >= 5.2.0
BuildRequires:  python2-jupyter-core >= 4.4.0
BuildRequires:  python2-mock
BuildRequires:  python2-nbconvert
BuildRequires:  python2-nbformat
BuildRequires:  python2-nose
BuildRequires:  python2-nose-exclude
BuildRequires:  python2-nose_warnings_filters
BuildRequires:  python2-pandocfilters
BuildRequires:  python2-prometheus_client
BuildRequires:  python2-requests
BuildRequires:  python2-send2trash
BuildRequires:  python2-terminado >= 0.8.1
BuildRequires:  python2-testpath
BuildRequires:  python2-tornado
BuildRequires:  python2-traitlets >= 4.2.1

# Docs:
BuildRequires:  python3-nbsphinx
BuildRequires:  python3-sphinx
BuildRequires:  python3-sphinx_rtd_theme
BuildRequires:  python3-ipython-sphinx


%?python_enable_dependency_generator

%global _description \
The Jupyter Notebook is a web application that allows you to create and \
share documents that contain live code, equations, visualizations, and \
explanatory text. The Notebook has support for multiple programming \
languages, sharing, and interactive widgets.

%description %_description

%package -n     python2-%{pypi_name}
Summary:        A web-based notebook environment for interactive computing
%{?python_provide:%python_provide python2-%{pypi_name}}
%{?python_provide:%python_provide python2-jupyter-%{pypi_name}}
%{?python_provide:%python_provide python2-ipython-%{pypi_name}}
Provides:       python2-jupyter-%{pypi_name} = %{version}-%{release}
Provides:       python2-ipython-%{pypi_name} = %{version}-%{release}
Obsoletes:      python2-ipython-%{pypi_name} < 4
Obsoletes:      python-ipython-%{pypi_name} < 4

Requires:       fontawesome-fonts
Requires:       fontawesome-fonts-web
Requires:       mathjax >= 2.6
Requires:       js-backbone >= 1.2
Requires:       js-marked >= 0.3
Requires:       js-moment >= 2.8
Requires:       js-underscore >= 1.8.3

# Versions from bower.json
# Updating this? Don't forgot the python3 subpackage
Provides:       bundled(bootstrap) = 3.3
Provides:       bundled(bootstrap-tour) = 0.9.0
Provides:       bundled(codemirror) = 5.27
Provides:       bundled(es6-promise) = 1.0
Provides:       bundled(google-caja) = 5669
Provides:       bundled(jed) = 1.1.1
Provides:       bundled(jquery) = 3.3
Provides:       bundled(jquery-typeahead) = 2.0.0
Provides:       bundled(jquery-ui) = 1.10
Provides:       bundled(preact) = 7.2.0
Provides:       bundled(preact-compat) = 3.14.3
Provides:       bundled(proptypes) = 0.14.4
Provides:       bundled(requirejs) = 2.1
Provides:       bundled(requirejs-text) = 2.0.15
Provides:       bundled(requirejs-plugins) = 1.0.3
Provides:       bundled(text-encoding) = 0.1
Provides:       bundled(xterm.js) = 2.9.2
# See https://bugzilla.redhat.com/show_bug.cgi?id=1580129
#Provides:       bundled(mathjax) = 2.7.4

%description -n python2-%{pypi_name} %_description

%package -n     python3-%{pypi_name}
Summary:        A web-based notebook environment for interactive computing
%{?python_provide:%python_provide python3-%{pypi_name}}
%{?python_provide:%python_provide python3-jupyter-%{pypi_name}}
%{?python_provide:%python_provide python3-ipython-%{pypi_name}}
Provides:       python3-jupyter-%{pypi_name} = %{version}-%{release}
Provides:       python3-ipython-%{pypi_name} = %{version}-%{release}
Obsoletes:      python3-ipython-%{pypi_name} < 4
Provides:       %{pypi_name} = %{version}-%{release}
Provides:       jupyter-%{pypi_name} = %{version}-%{release}

Requires:       fontawesome-fonts
Requires:       fontawesome-fonts-web
Requires:       mathjax >= 2.6
Requires:       js-backbone >= 1.2
Requires:       js-marked >= 0.3
Requires:       js-moment >= 2.8
Requires:       js-underscore >= 1.8.3

# Versions from bower.json
# Updating this? Don't forgot the python2 subpackage
Provides:       bundled(bootstrap) = 3.3
Provides:       bundled(bootstrap-tour) = 0.9.0
Provides:       bundled(codemirror) = 5.27
Provides:       bundled(es6-promise) = 1.0
Provides:       bundled(google-caja) = 5669
Provides:       bundled(jed) = 1.1.1
Provides:       bundled(jquery) = 3.3
Provides:       bundled(jquery-typeahead) = 2.0.0
Provides:       bundled(jquery-ui) = 1.10
Provides:       bundled(preact) = 7.2.0
Provides:       bundled(preact-compat) = 3.14.3
Provides:       bundled(proptypes) = 0.14.4
Provides:       bundled(requirejs) = 2.1
Provides:       bundled(requirejs-text) = 2.0.15
Provides:       bundled(requirejs-plugins) = 1.0.3
Provides:       bundled(text-encoding) = 0.1
Provides:       bundled(xterm.js) = 2.9.2
# See https://bugzilla.redhat.com/show_bug.cgi?id=1580129
#Provides:       bundled(mathjax) = 2.7.4

%description -n python3-%{pypi_name} %_description

%package -n python-%{pypi_name}-doc
Summary:        notebook documentation
%description -n python-%{pypi_name}-doc
Documentation for notebook


%prep
%autosetup -n %{pypi_name}-%{uversion} -S git

%build
%py2_build
%py3_build

# generate html docs
sphinx-build-3 -D intersphinx_timeout=1 docs/source html
# remove the sphinx-build leftovers
rm -rf html/.{doctrees,buildinfo}


%install
# We do Python 2 installation first and we remove all the executables
# This way it's safe to assume all the executables will be Python 3
%py2_install
rm -f %{buildroot}%{_bindir}/*

# The selenium tests are python2 incompatible
# https://github.com/jupyter/notebook/pull/3458/files#r187654631
rm -rf %{buildroot}%{python2_sitelib}/%{pypi_name}/tests/selenium

%py3_install

# https://github.com/jupyter/notebook/issues/2373
rm -f %{buildroot}%{_bindir}/less-watch

# unbundle stuff
for SITELIB in %{python2_sitelib} %{python3_sitelib}; do
  pushd %{buildroot}${SITELIB}/%{pypi_name}/static/components

  rm -r font-awesome/fonts
  ln -vfs %{_datadir}/fonts/fontawesome font-awesome/fonts

  #temporarily kept bundled to workaround #1580129
  rm -r MathJax
  ln -vfs %{_datadir}/javascript/mathjax MathJax

  rm -r backbone
  ln -vfs %{_datadir}/javascript/backbone backbone

  rm -r marked/lib
  ln -vfs %{_datadir}/javascript/marked marked/lib

  rm -r moment
  ln -vfs %{_datadir}/javascript/moment moment

  rm -r underscore
  ln -vfs %{_datadir}/javascript/underscore underscore

  popd
done


%check
LANG=C.utf-8 nosetests-2 -v --exclude-dir notebook/tests/selenium
LANG=C.utf-8 nosetests-3 -v --exclude-dir notebook/tests/selenium


%files -n python2-%{pypi_name}
%doc README.md
%license COPYING.md
%{python2_sitelib}/%{pypi_name}-%{uversion}-py?.?.egg-info
%{python2_sitelib}/%{pypi_name}/

%files -n python3-%{pypi_name}
%doc README.md
%license COPYING.md
%{_bindir}/jupyter-bundlerextension
%{_bindir}/jupyter-nbextension
%{_bindir}/jupyter-serverextension
%{_bindir}/jupyter-notebook
%{python3_sitelib}/%{pypi_name}-%{uversion}-py?.?.egg-info
%{python3_sitelib}/%{pypi_name}/

%files -n python-%{pypi_name}-doc
%doc html
%license COPYING.md


%changelog
* Mon Aug 13 2018 Miro Hrončok <mhroncok@redhat.com> - 5.6.0-2
- Require mathjax from python3-notebook (#1615192)

* Mon Jul 23 2018 Miro Hrončok <mhroncok@redhat.com> - 5.6.0-1
- Update to 5.6.0 (#1601163)

* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 5.5.0-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 5.5.0-6
- Rebuilt for Python 3.7

* Tue Jun 05 2018 Miro Hrončok <mhroncok@redhat.com> - 5.5.0-5
- Reintroduce the python2 subpackage for sagemath

* Sun May 27 2018 Miro Hrončok <mhroncok@redhat.com> - 5.5.0-4
- Drop the python2 leaf subpackage

* Sat May 26 2018 Jonathan Underwood <jonathan.underwood@gmail.com> - 5.5.0-3
- Unbundle mathjax once more
- Add patch to use the MathJax TeX fonts rather than the STIXWeb ones BZ: 1581899, 1580129

* Wed May 23 2018 Miro Hrončok <mhroncok@redhat.com> - 5.5.0-2
- BR ipykernel >= 4.8 (#1581723)
- Temporarily keep bundled mathjax (#1580129)

* Fri May 11 2018 Miro Hrončok <mhroncok@redhat.com> - 5.5.0-1
- Update to 5.5.0 (#1557990)
- Disable selenium tests and rm them from python2 sitelib

* Wed Mar 21 2018 Miro Hrončok <mhroncok@redhat.com> - 5.4.0-2
- Security fix for CVE-2018-8768 (#1558783)

* Wed Feb 21 2018 Miro Hrončok <mhroncok@redhat.com> - 5.4.0-1
- Update to 5.4.0 (#1535263)

* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 5.3.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Fri Jan 19 2018 Miro Hrončok <mhroncok@redhat.com> - 5.3.0-1
- Update to 5.3.0
- Enable automatic dependency generator, drop manual Python requires

* Tue Jan 09 2018 Miro Hrončok <mhroncok@redhat.com> - 5.3.0-0.1.rc1
- Update to new 5.3.0rc1 version (#1532430)
- Only BR git-core instead of full git, it is sufficient
- Be more explciit about (Build)Required versions
- Require send2trash, dateutil

* Thu Nov 23 2017 Miro Hrončok <mhroncok@redhat.com> - 5.2.1-1
- Update to new 5.2.1 version (#1504386)

* Fri Sep 15 2017 Miro Hrončok <mhroncok@redhat.com> - 5.1.0-1
- Update to new 5.1.0 final version (#1491890)

* Tue Sep 12 2017 Miro Hrončok <mhroncok@redhat.com> - 5.1.0-0.2.rc3
- Update to new 5.1.0rc3 version (#1490880)
- Remove 2 merged patches

* Wed Aug 23 2017 Miro Hrončok <mhroncok@redhat.com> - 5.1.0-0.1.rc2
- Update to new 5.1.0rc2 version (#1482722)
- Use node to compile JS and CSS

* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 5.0.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Tue Apr 04 2017 Miro Hrončok <mhroncok@redhat.com> - 5.0.0-1
- Update to new 5.0.0 version (#1438917)
- Use autosetup with git
- Add the license file to the doc subpackage

* Fri Mar 17 2017 Miro Hrončok <mhroncok@redhat.com> - 4.4.1-3
- Recommend terminado

* Tue Feb 21 2017 Miro Hrončok <mhroncok@redhat.com> - 4.4.1-2
- Make sure the Python 3 executables are really Python 3
- Build the docs
- Run the tests
- Use python2- where possible
- Unbundle some things, declare the rest
- Use the %%_description macro consistently
- Provide pythonX-jupyter-notebook
- Provide/Obsolete pythonX-ipython-notebook

* Thu Feb 09 2017 Thomas Spura <tomspur@fedoraproject.org> - 4.4.1-1
- rename to python-notebook
- only ship python3 executables
- update to 4.4.1

* Mon Apr 18 2016 Thomas Spura <tomspur@fedoraproject.org> - 4.2.0-1
- Initial package.