From 2e5bf94715d718de2e0f956f7b217514466a8998 Mon Sep 17 00:00:00 2001 From: Jerry James Date: Wed, 4 Jul 2018 14:15:07 -0600 Subject: [PATCH] Rebuild for ntl 11.1.0. Optionally bundle thebe, threejs, and widgetsnbextension. Add provides for the optionally bundled packages. Add -flask patch. Apply new guidelines for python files in nonstandard places. --- sagemath-flask.patch | 201 +++++++++++++++++++++++++++++++++++++++++++ sagemath.spec | 121 +++++++++++++++++++++++++- 2 files changed, 321 insertions(+), 1 deletion(-) create mode 100644 sagemath-flask.patch diff --git a/sagemath-flask.patch b/sagemath-flask.patch new file mode 100644 index 0000000..e6f8061 --- /dev/null +++ b/sagemath-flask.patch @@ -0,0 +1,201 @@ +--- build/pkgs/sagenb/src/sagenb/flask_version/admin.py.orig 2017-06-02 16:24:20.000000000 -0600 ++++ build/pkgs/sagenb/src/sagenb/flask_version/admin.py 2018-06-15 16:07:44.250325912 -0600 +@@ -1,7 +1,7 @@ + import os + from flask import Blueprint, url_for, render_template, request, session, redirect, g, current_app + from .decorators import login_required, admin_required, with_lock +-from flask.ext.babel import Babel, gettext, ngettext, lazy_gettext ++from flask_babel import Babel, gettext, ngettext, lazy_gettext + _ = gettext + + admin = Blueprint('admin', 'sagenb.flask_version.admin') +--- build/pkgs/sagenb/src/sagenb/flask_version/authentication.py.orig 2017-06-02 16:24:20.000000000 -0600 ++++ build/pkgs/sagenb/src/sagenb/flask_version/authentication.py 2018-06-15 16:06:44.083100080 -0600 +@@ -2,7 +2,7 @@ import os + import random + from flask import Blueprint, url_for, render_template, request, session, redirect, g, current_app + from .decorators import with_lock +-from flask.ext.babel import gettext, ngettext, lazy_gettext ++from flask_babel import gettext, ngettext, lazy_gettext + _ = gettext + + authentication = Blueprint('authentication', +--- build/pkgs/sagenb/src/sagenb/flask_version/base.py.orig 2018-06-15 13:17:46.940191938 -0600 ++++ build/pkgs/sagenb/src/sagenb/flask_version/base.py 2018-06-15 16:09:19.512516887 -0600 +@@ -8,11 +8,11 @@ from flask import Flask, Blueprint, url_ + from .decorators import login_required, guest_or_login_required, with_lock + from .decorators import global_lock + +-from flask.ext.autoindex import AutoIndex ++from flask_autoindex import AutoIndex + from sage.env import SAGE_SRC, SAGE_DOC + SRC = os.path.join(SAGE_SRC, 'sage') +-from flask.ext.openid import OpenID +-from flask.ext.babel import Babel, gettext, ngettext, lazy_gettext, get_locale ++from flask_openid import OpenID ++from flask_babel import Babel, gettext, ngettext, lazy_gettext, get_locale + from sagenb.misc.misc import SAGENB_ROOT, DATA, translations_path, N_, nN_, unicode_str + from json import dumps + from sagenb.notebook.cell import number_of_rows +--- build/pkgs/sagenb/src/sagenb/flask_version/decorators.py.orig 2017-06-02 16:24:20.000000000 -0600 ++++ build/pkgs/sagenb/src/sagenb/flask_version/decorators.py 2018-06-15 16:09:33.447105994 -0600 +@@ -1,6 +1,6 @@ + from functools import wraps + from flask import Flask, url_for, render_template, request, session, redirect, g, current_app +-from flask.ext.babel import Babel, gettext, ngettext, lazy_gettext ++from flask_babel import Babel, gettext, ngettext, lazy_gettext + _ = gettext + + from threading import Lock +--- build/pkgs/sagenb/src/sagenb/flask_version/doc.py.orig 2017-06-02 16:24:20.000000000 -0600 ++++ build/pkgs/sagenb/src/sagenb/flask_version/doc.py 2018-06-15 16:09:43.966795797 -0600 +@@ -18,7 +18,7 @@ import os + from flask import Blueprint, url_for, render_template, request, session, redirect, g, current_app + from .decorators import login_required, guest_or_login_required + +-from flask.ext.babel import gettext, ngettext, lazy_gettext ++from flask_babel import gettext, ngettext, lazy_gettext + _ = gettext + + doc = Blueprint('doc', 'sagenb.flask_version.doc') +--- build/pkgs/sagenb/src/sagenb/flask_version/settings.py.orig 2017-06-02 16:24:20.000000000 -0600 ++++ build/pkgs/sagenb/src/sagenb/flask_version/settings.py 2018-06-15 16:09:55.078468143 -0600 +@@ -2,7 +2,7 @@ import os + import random + from flask import Blueprint, url_for, render_template, request, session, redirect, g, current_app + from .decorators import login_required, with_lock +-from flask.ext.babel import gettext, ngettext, lazy_gettext ++from flask_babel import gettext, ngettext, lazy_gettext + _ = gettext + + +--- build/pkgs/sagenb/src/sagenb/flask_version/worksheet_listing.py.orig 2017-06-02 16:24:20.000000000 -0600 ++++ build/pkgs/sagenb/src/sagenb/flask_version/worksheet_listing.py 2018-06-15 16:07:22.393970396 -0600 +@@ -5,7 +5,7 @@ import os + import urllib, urlparse + from flask import Blueprint, url_for, render_template, request, session, redirect, g, current_app + from .decorators import login_required, guest_or_login_required, with_lock +-from flask.ext.babel import Babel, gettext, ngettext, lazy_gettext ++from flask_babel import Babel, gettext, ngettext, lazy_gettext + _ = gettext + + worksheet_listing = Blueprint('worksheet_listing', +--- build/pkgs/sagenb/src/sagenb/flask_version/worksheet.py.orig 2017-06-02 16:24:20.000000000 -0600 ++++ build/pkgs/sagenb/src/sagenb/flask_version/worksheet.py 2018-06-15 16:07:04.820488591 -0600 +@@ -8,7 +8,7 @@ from flask import Blueprint, make_respon + from .decorators import login_required, with_lock + from collections import defaultdict + from werkzeug.utils import secure_filename +-from flask.ext.babel import Babel, gettext, ngettext, lazy_gettext ++from flask_babel import Babel, gettext, ngettext, lazy_gettext + _ = gettext + + from sagenb.notebook.interact import INTERACT_UPDATE_PREFIX +--- build/pkgs/sagenb/src/sagenb/notebook/challenge.py.orig 2017-06-02 16:24:20.000000000 -0600 ++++ build/pkgs/sagenb/src/sagenb/notebook/challenge.py 2018-06-15 16:10:52.222783112 -0600 +@@ -32,7 +32,7 @@ from six.moves.urllib.parse import urlen + from six.moves.urllib.request import urlopen, Request + + from sagenb.notebook.template import template +-from flask.ext.babel import gettext, lazy_gettext ++from flask_babel import gettext, lazy_gettext + _ = lazy_gettext + + class ChallengeResponse(object): +--- build/pkgs/sagenb/src/sagenb/notebook/conf.py.orig 2017-06-02 16:24:20.000000000 -0600 ++++ build/pkgs/sagenb/src/sagenb/notebook/conf.py 2018-06-15 16:10:52.223783083 -0600 +@@ -10,7 +10,7 @@ from __future__ import absolute_import + # The full text of the GPL is available at: + # http://www.gnu.org/licenses/ + ############################################################################# +-from flask.ext.babel import gettext, lazy_gettext ++from flask_babel import gettext, lazy_gettext + + POS = 'pos' + DESC = 'desc' +--- build/pkgs/sagenb/src/sagenb/notebook/notebook.py.orig 2017-06-02 16:24:20.000000000 -0600 ++++ build/pkgs/sagenb/src/sagenb/notebook/notebook.py 2018-06-15 16:10:52.236782699 -0600 +@@ -51,7 +51,7 @@ from . import server_conf # server conf + from . import user_conf # user configuration + from . import user # users + from .template import template, prettify_time_ago +-from flask.ext.babel import gettext, lazy_gettext ++from flask_babel import gettext, lazy_gettext + + try: + # sage is installed +--- build/pkgs/sagenb/src/sagenb/notebook/register.py.orig 2017-06-02 16:24:20.000000000 -0600 ++++ build/pkgs/sagenb/src/sagenb/notebook/register.py 2018-06-15 16:10:52.236782699 -0600 +@@ -12,7 +12,7 @@ + """ + Helper functions dealing with the verification of user + """ +-from flask.ext.babel import gettext as _ ++from flask_babel import gettext as _ + + def build_msg(key, username, addr, port, secure): + url_prefix = "https" if secure else "http" +--- build/pkgs/sagenb/src/sagenb/notebook/server_conf.py.orig 2017-06-02 16:24:20.000000000 -0600 ++++ build/pkgs/sagenb/src/sagenb/notebook/server_conf.py 2018-06-15 16:10:52.238782641 -0600 +@@ -8,7 +8,7 @@ from . import conf + from .conf import (POS, DESC, GROUP, TYPE, CHOICES, T_BOOL, T_INTEGER, + T_CHOICE, T_REAL, T_COLOR, T_STRING, T_LIST, T_INFO) + from sagenb.misc.misc import get_languages, N_ +-from flask.ext.babel import gettext, lazy_gettext ++from flask_babel import gettext, lazy_gettext + _ = lazy_gettext + + defaults = {'word_wrap_cols':72, +--- build/pkgs/sagenb/src/sagenb/notebook/template.py.orig 2017-06-02 16:24:20.000000000 -0600 ++++ build/pkgs/sagenb/src/sagenb/notebook/template.py 2018-06-15 16:10:52.238782641 -0600 +@@ -21,7 +21,7 @@ import jinja2 + import os, re, sys + + from sagenb.misc.misc import SAGE_VERSION, DATA +-from flask.ext.babel import gettext, ngettext, lazy_gettext ++from flask_babel import gettext, ngettext, lazy_gettext + from flask import current_app as app + + if 'SAGENB_TEMPLATE_PATH' in os.environ: +--- build/pkgs/sagenb/src/sagenb/notebook/tutorial.py.orig 2017-06-02 16:24:20.000000000 -0600 ++++ build/pkgs/sagenb/src/sagenb/notebook/tutorial.py 2018-06-15 16:10:52.239782611 -0600 +@@ -348,7 +348,7 @@ the "save" command), and get back to whe + + ##################################### + +-from flask.ext.babel import lazy_gettext as _ ++from flask_babel import lazy_gettext as _ + + notebook_help = [ + (_('Find Help and Documentation'), +--- build/pkgs/sagenb/src/sagenb/notebook/user_conf.py.orig 2017-06-02 16:24:20.000000000 -0600 ++++ build/pkgs/sagenb/src/sagenb/notebook/user_conf.py 2018-06-15 16:10:52.239782611 -0600 +@@ -8,7 +8,7 @@ from . import server_conf + from .conf import (Configuration, POS, DESC, GROUP, TYPE, CHOICES, T_BOOL, + T_INTEGER, T_CHOICE, T_REAL, T_COLOR, T_STRING, T_LIST) + from sagenb.misc.misc import SAGENB_ROOT, get_languages +-from flask.ext.babel import lazy_gettext ++from flask_babel import lazy_gettext + + defaults = {'max_history_length':1000, + 'default_system':'sage', +--- build/pkgs/sagenb/src/sagenb/notebook/worksheet.py.orig 2017-06-02 16:24:20.000000000 -0600 ++++ build/pkgs/sagenb/src/sagenb/notebook/worksheet.py 2018-06-15 16:10:52.248782346 -0600 +@@ -57,7 +57,7 @@ from sagenb.misc.format import relocate_ + # Imports specifically relevant to the sage notebook + from .cell import Cell, TextCell + from .template import template, clean_name, prettify_time_ago +-from flask.ext.babel import gettext, lazy_gettext ++from flask_babel import gettext, lazy_gettext + _ = gettext + + # Set some constants that will be used for regular expressions below. +@@ -4527,7 +4527,7 @@ def convert_time_to_string(t): + Converts ``t`` (in Unix time) to a locale-specific string + describing the time and date. + """ +- from flask.ext.babel import format_datetime ++ from flask_babel import format_datetime + import datetime, time + try: + return format_datetime(datetime.datetime.fromtimestamp(float(t))) diff --git a/sagemath.spec b/sagemath.spec index 84302d2..7275579 100644 --- a/sagemath.spec +++ b/sagemath.spec @@ -1,8 +1,14 @@ %global __provides_exclude_from .*/site-packages/.*\\.so +# This package install python files in nonstandard places +%global _python_bytecompile_extra 0 + %bcond_with bundled_pexpect %bcond_with bundled_ipython %bcond_without bundled_ipywidgets +%bcond_without bundled_thebe +%bcond_without bundled_threejs +%bcond_without bundled_widgetsnbextension %bcond_without install_hack # for faster full rpm test builds @@ -52,6 +58,15 @@ %global sagenb_export_pkg sagenb_export-3.2 %global sagetex_pkg sagetex-3.0 %global Sphinx_pkg Sphinx-1.6.3 +%if %{with bundled_thebe} +%global thebe_pkg thebe-9624e0a0 +%endif +%if %{with bundled_threejs} +%global threejs_pkg threejs-r80 +%endif +%if %{with bundled_widgetsnbextension} +%global widgetsnbextension_pkg widgetsnbextension-3.1.1 +%endif %global SAGE_ROOT %{_libdir}/sagemath %global SAGE_LOCAL %{SAGE_ROOT}/local @@ -168,6 +183,9 @@ Patch25: %{name}-includes.patch # Use atlas blas Patch26: %{name}-atlas.patch +# Adapt to recent versions of the flask packages +Patch27: %{name}-flask.patch + BuildRequires: 4ti2 BuildRequires: arb-devel BuildRequires: atlas-devel @@ -416,6 +434,13 @@ Requires: tachyon Requires: texlive Requires: vecmath +%if %{with bundled_thebe} +Provides: bundled(thebe) = %(cut -d- -f2- <<< %{thebe_pkg}) +%endif +%if %{with bundled_threejs} +Provides: bundled(threejs) = %(cut -d- -f2- <<< %{threejs_pkg}) +%endif + %description Sage is a free open-source mathematics software system licensed under the GPL. It combines the power of many existing open-source @@ -426,6 +451,15 @@ packages into a common Python-based interface. Summary: Open Source Mathematics Software Requires: %{name}%{?_isa} = %{version}-%{release} Obsoletes: %{name}-devel < 6.8-1 +%if %{with bundled_ipython} +Provides: bundled(ipython) = %(cut -d- -f2- <<< %{ipython_pkg}) +%endif +%if %{with bundled_ipywidgets} +Provides: bundled(ipywidgets) = %(cut -d- -f2- <<< %{ipywidgets_pkg}) +%endif +%if %{with bundled_widgetsnbextension} +Provides: bundled(widgetsnbextension) = %(cut -d- -f2- <<< %{widgetsnbextension_pkg}) +%endif %description core This package contains the core sagemath python modules. @@ -759,6 +793,28 @@ popd %endif %endif +%if %{with bundled_thebe} +pushd build/pkgs/thebe + unzip ../../../upstream/%{thebe_pkg}.zip + mv %{thebe_pkg}* src +popd +%endif + +%if %{with bundled_threejs} +pushd build/pkgs/threejs + mkdir src + cd src + tar zxf ../../../../upstream/%{threejs_pkg}.tar.gz +popd +%endif + +%if %{with bundled_widgetsnbextension} +pushd build/pkgs/widgetsnbextension + tar zxf ../../../upstream/%{widgetsnbextension_pkg}.tar.gz + mv %{widgetsnbextension_pkg} src +popd +%endif + %patch1 %patch2 %patch3 @@ -790,6 +846,7 @@ popd %patch24 %patch25 %patch26 +%patch27 sed -e 's|@@SAGE_ROOT@@|%{SAGE_ROOT}|' \ -e 's|@@SAGE_DOC@@|%{SAGE_DOC}|' \ @@ -824,6 +881,10 @@ sed -i 's,#!%{_bindir}/env sage-python23,#!%{_bindir}/python2,' \ $(grep -Frl '#!%{_bindir}/env sage-python23') sed -i 's,#!%{_bindir}/env ,#!%{_bindir}/,' $(grep -Frl '#!%{_bindir}/env') sed -i 's,#!%{_bindir}/python$,&2,' $(grep -Frl '#!%{_bindir}/python') +sed -i 's,%{_bindir}/python,&2,' src/sage/misc/dev_tools.py +sed -e 's,local/bin/python,bin/python,' \ + -e 's,#!%{_bindir}/python,&2,' \ + -i src/sage/repl/preparse.py ######################################################################## %build @@ -877,6 +938,13 @@ pushd build/pkgs/ipywidgets/src popd %endif +%if %{with bundled_widgetsnbextension} +pushd build/pkgs/widgetsnbextension/src + %__python2 setup.py build + %__python2 setup.py install --root %{_builddir} +popd +%endif + %if %{with cython_hack} cp -far %{python2_sitearch}/Cython %{_builddir}%{python2_sitearch} BASE=$PWD/build/pkgs/cython/patches/ @@ -1162,6 +1230,29 @@ mv %{_builddir}%{_bindir}/ip* %{buildroot}%{SAGE_LOCAL}/bin mv %{_builddir}%{python2_sitelib}/ipywidgets %{buildroot}%{SAGE_PYTHONPATH} %endif +#------------------------------------------------------------------------ +%if %{with bundled_thebe} +pushd build/pkgs/thebe + mkdir -p $SAGE_SHARE/thebe + cp -p src/static/main-built.js $SAGE_SHARE/thebe/thebe.js +popd +%endif + +#------------------------------------------------------------------------ +%if %{with bundled_threejs} +pushd build/pkgs/threejs + cp -a src $SAGE_SHARE/threejs +popd +%endif + +#------------------------------------------------------------------------ +%if %{with bundled_widgetsnbextension} +pushd build/pkgs/widgetsnbextension/src + %py2_install "--install-purelib=%{python2_sitelib}" + mv %{buildroot}%{_prefix}%{_sysconfdir} %{buildroot}%{_sysconfdir} +popd +%endif + #------------------------------------------------------------------------ cat > %{buildroot}%{_bindir}/sage << EOF #!/bin/bash -i @@ -1402,6 +1493,10 @@ chmod +x %{buildroot}%{SAGE_LOCAL}/bin/sage-list-packages rm -fr %{buildroot}%{SAGE_DOC}/inventory %endif +#------------------------------------------------------------------------ +# Byte compile python files in nonstandard places +%py_byte_compile %{__python2} %{buildroot}%{_texmf_main}/tex/latex/sagetex + # last install command rm -fr $DOT_SAGE @@ -1452,6 +1547,7 @@ exit 0 %doc %{SAGE_ROOT}/COPYING.txt %dir %{SAGE_LOCAL} %dir %{SAGE_LOCAL}/bin +%dir %{SAGE_SHARE} %{SAGE_LOCAL}/bin/QuadraticSieve %{SAGE_LOCAL}/bin/ecm %{SAGE_LOCAL}/bin/gap @@ -1478,6 +1574,14 @@ exit 0 %{_datadir}/pixmaps/%{name}.png %{_datadir}/applications/%{name}.desktop %{SAGE_SPKG_INST} +%if %{with bundled_thebe} +# MIT +%{SAGE_SHARE}/thebe +%endif +%if %{with bundled_threejs} +# MIT +%{SAGE_SHARE}/threejs +%endif #------------------------------------------------------------------------ %files core @@ -1492,6 +1596,14 @@ exit 0 %if %{with bundled_ipywidgets} %{SAGE_PYTHONPATH}/ipywidgets %endif +%if %{with bundled_widgetsnbextension} +%dir %{_sysconfdir}/jupyter +%dir %{_sysconfdir}/jupyter/nbconfig +%dir %{_sysconfdir}/jupyter/nbconfig/notebook.d +%config(noreplace) %{_sysconfdir}/jupyter/nbconfig/notebook.d/*.json +%{_datadir}/jupyter/ +%{python2_sitelib}/widgetsnbextension* +%endif #------------------------------------------------------------------------ %files data @@ -1697,7 +1809,14 @@ exit 0 ######################################################################## %changelog -* Fri May 18 2018 Jerry James - 8.2-1 +* Tue Jul 3 2018 Jerry James - 8.2-2 +- Rebuild for ntl 11.1.0 +- Optionally bundle thebe, threejs, and widgetsnbextension +- Add provides for the optionally bundled packages +- Add -flask patch +- Apply new guidelines for python files in nonstandard places + +* Fri May 18 2018 Jerry James - 8.2-1 - Update to sagemath 8.2 - Create the sagemath-data-combinatorial_designs subpackage - Create the sagemath-notebook-export subpackage