--- build/pkgs/sagenb/src/sagenb/flask_version/worksheet_listing.py.orig 2018-01-24 04:17:47.000000000 -0700
+++ build/pkgs/sagenb/src/sagenb/flask_version/worksheet_listing.py 2018-10-25 13:25:53.284617298 -0600
@@ -2,7 +2,12 @@
"""
from __future__ import absolute_import
import os
-import urllib, urlparse
+try:
+ from urllib.request import urlopen
+ from urllib.parse import urlparse
+except ImportError:
+ from urlparse import urlparse
+ from urllib import urlopen
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_babel import Babel, gettext, ngettext, lazy_gettext
--- build/pkgs/sagenb/src/sagenb/misc/sphinxify.py.orig 2018-06-10 13:56:16.000000000 -0600
+++ build/pkgs/sagenb/src/sagenb/misc/sphinxify.py 2018-10-25 13:29:39.187960000 -0600
@@ -19,6 +19,7 @@ AUTHORS:
import os
import re
import shutil
+import six.moves
from tempfile import mkdtemp
# We import Sphinx on demand, to reduce Sage startup time.
@@ -94,9 +95,8 @@ def sphinxify(docstring, format='html'):
suffix = '.txt'
output_name = base_name + suffix
- filed = open(rst_name, 'w')
- filed.write(docstring)
- filed.close()
+ with open(rst_name, 'w') as filed:
+ filed.write(docstring)
# Sphinx constructor: Sphinx(srcdir, confdir, outdir, doctreedir,
# buildername, confoverrides, status, warning, freshenv).
@@ -120,8 +120,8 @@ def sphinxify(docstring, format='html'):
sys.path = old_sys_path
#We need to remove "_" from __builtin__ that the gettext module installs
- import __builtin__
- __builtin__.__dict__.pop('_', None)
+ from six.moves import builtins
+ builtins.__dict__.pop('_', None)
if os.path.exists(output_name):
output = open(output_name, 'r').read()
@@ -481,7 +481,7 @@ skip_picklability_check_modules = [
#'sage.misc.nested_class_test', # for test only
'sage.misc.latex',
'sage.misc.explain_pickle',
- '__builtin__',
+ 'builtins',
]
def check_nested_class_picklability(app, what, name, obj, skip, options):
@@ -532,7 +532,7 @@ def skip_member(app, what, name, obj, sk
if 'SAGE_CHECK_NESTED' in os.environ:
check_nested_class_picklability(app, what, name, obj, skip, options)
- if getattr(obj, '__module__', None) == '__builtin__':
+ if getattr(obj, '__module__', None) == 'builtins':
return True
if (hasattr(obj, '__name__') and obj.__name__.find('.') != -1 and
--- build/pkgs/sagenb/src/sagenb/misc/support.py.orig 2018-05-22 10:01:48.000000000 -0600
+++ build/pkgs/sagenb/src/sagenb/misc/support.py 2018-10-25 13:30:02.499892169 -0600
@@ -17,7 +17,7 @@ import sys
import pydoc
from six import iteritems
-import __builtin__
+import builtins
try:
from cPickle import PicklingError
@@ -467,7 +467,7 @@ def cython_import(filename, verbose=Fals
use_cache=use_cache,
create_local_c_file=create_local_c_file)
sys.path.append(build_dir)
- return __builtin__.__import__(name)
+ return builtins.__import__(name)
def cython_import_all(filename, globals, verbose=False, compile_message=False,
--- build/pkgs/sagenb/src/sagenb/notebook/cell.py.orig 2018-08-29 08:44:38.823169061 -0600
+++ build/pkgs/sagenb/src/sagenb/notebook/cell.py 2018-10-25 13:30:55.707737342 -0600
@@ -20,6 +20,7 @@ import shutil
import textwrap
import time
from cgi import escape
+from sys import maxsize
from sagenb.misc.misc import (word_wrap, strip_string_literals,
set_restrictive_permissions, unicode_str,
@@ -701,9 +702,8 @@ class Cell(Cell_generic):
# start with a random integer so that evaluations of the cell
# from different runs have different version numbers.
- from sys import maxint
from random import randint
- self._version = randint(0,maxint)
+ self._version = randint(0,maxsize)
def __repr__(self):
"""
@@ -2189,9 +2189,8 @@ class Cell(Cell_generic):
except AttributeError:
# start with a random integer so that evaluations of the cell
# from different runs have different version numbers.
- from sys import maxint
from random import randint
- self._version = randint(0,maxint)
+ self._version = randint(0,maxsize)
return self._version
def time(self):
--- build/pkgs/sagenb/src/sagenb/notebook/docHTMLProcessor.py.orig 2018-01-24 04:17:38.000000000 -0700
+++ build/pkgs/sagenb/src/sagenb/notebook/docHTMLProcessor.py 2018-10-25 13:35:09.227001150 -0600
@@ -7,7 +7,7 @@ file.
This takes an HTML document, i.e., Sage documentation, and returns it in
the editable format (notebook worksheet format with evaluable examples). It
-also returns a string representing the CSS link for the document. The SGML
+also returns a string representing the CSS link for the document. The HTML
parser is setup to return only the body of the HTML documentation page and
to re-format Sage examples and type-setting.
@@ -25,7 +25,7 @@ This module contains three classes:
.. NOTE::
- This extension of sgmllib.SGMLParser was partly inspired by Mark
+ This extension of html.parser.HTMLParser was partly inspired by Mark
Pilgrim's 'Dive Into Python' examples.
AUTHORS:
@@ -111,14 +111,14 @@ WARNING:
#############################################################################
from __future__ import unicode_literals
-from sgmllib import SGMLParser
+from html.parser import HTMLParser
from htmlentitydefs import entitydefs
from flask import Markup
from sagenb.misc.misc import unicode_str
-class genericHTMLProcessor(SGMLParser):
+class genericHTMLProcessor(HTMLParser):
r"""
This class gathers the methods that are common to both classes
:class:`sagenb.notebook.SphinxHTMLProcessor` and
@@ -155,16 +155,16 @@ class genericHTMLProcessor(SGMLParser):
u'
Title
\n\nnSome text
\n\n\n\n'
"""
- # self.feed() is a SGMLParser method and starts everything
+ # self.feed() is an HTMLParser method and starts everything
# off; Most of the functions here are extensions to
- # SGMLParser, and may never actually be visibly called here.
+ # HTMLParser, and may never actually be visibly called here.
# This module works with unicode literals. In case that input data is
# ascii, exceptions may occur. So, input data must be converted to
# unicode if it were not.
doc_in = unicode_str(doc_in)
- self.feed(doc_in) #SGMLParser call
- self.close() #SGMLParser call
+ self.feed(doc_in) #HTMLParser call
+ self.close() #HTMLParser call
self.hand_off_temp_pieces('to_doc_pieces')
return self.all_pieces.replace('\\(', '').replace('\\)', '').replace('\\[', '').replace('\\]', '')
@@ -390,7 +390,7 @@ class genericHTMLProcessor(SGMLParser):
else:
# first occurrence of an output string
# write /// denoting output
- if output_flag == False:
+ if output_flag is False:
piece += '///'
if p:
piece += '\n' + p
@@ -400,7 +400,29 @@ class genericHTMLProcessor(SGMLParser):
piece += p
piece += '\n}}}\n\n'
return Markup(piece).unescape()
-
+
+ def handle_starttag(self, tag, attrs):
+ """
+ introduced when replacing SGMLParser by HTMLParser
+ """
+ try:
+ method = getattr(self, 'start_' + tag)
+ except AttributeError:
+ self.unknown_starttag(tag, attrs)
+ else:
+ method(attrs)
+
+ def handle_endtag(self, tag):
+ """
+ introduced when replacing SGMLParser by HTMLParser
+ """
+ try:
+ method = getattr(self, 'end_' + tag)
+ except AttributeError:
+ self.unknown_endtag(tag)
+ else:
+ method()
+
##############################################
## General tag handlers
## These just append their HTML to self.temp_pieces.
@@ -473,6 +495,7 @@ class genericHTMLProcessor(SGMLParser):
"""
if self.keep_data:
self.temp_pieces.append(data)
+
def handle_charref(self, ref):
r"""
INPUT:
@@ -540,6 +563,7 @@ class genericHTMLProcessor(SGMLParser):
"""
if self.keep_data:
self.temp_pieces.append("" % locals())
+
def handle_pi(self, text):
r"""
Handle processing instructions
@@ -585,7 +609,7 @@ class genericHTMLProcessor(SGMLParser):
"""
if self.keep_data:
self.temp_pieces.append("" % locals())
-
+
##############################################
## Specific tag handlers
def start_body(self, attrs):
@@ -634,6 +658,7 @@ class genericHTMLProcessor(SGMLParser):
['bunch ', 'of ', 'tmp ', 'strings']
"""
pass
+
def end_html(self):
r"""
INPUT:
@@ -658,7 +683,7 @@ class SphinxHTMLProcessor(genericHTMLPro
def reset(self):
r"""
Initialize necessary variables. Called by
- :meth:`SGMLParser.__init__`.
+ :meth:`HTMLParser.__init__`.
EXAMPLES::
@@ -685,8 +710,8 @@ class SphinxHTMLProcessor(genericHTMLPro
# counters
self.cellcount = 0
-
- SGMLParser.reset(self)
+
+ HTMLParser.reset(self)
def false_positive_input_output_cell(self, cell_piece):
r"""
@@ -733,7 +758,7 @@ class SphinxHTMLProcessor(genericHTMLPro
Once we hit the tag in a highlighted block,
hand of all of the pieces we've encountered so far
and ignore the tag.
-
+
INPUT:
- ``attrs`` - list of tuple
@@ -835,7 +860,7 @@ class SphinxHTMLProcessor(genericHTMLPro
self.hand_off_temp_pieces('to_cell_pieces')
return
self.temp_pieces.append("
")
-
+
def start_pre(self, attrs):
r"""
Ignore tag when inside highligh div.
@@ -1000,6 +1025,7 @@ class SphinxHTMLProcessor(genericHTMLPro
if self.in_highlight_div:
return
self.unknown_starttag('span', attrs)
+
def end_span(self):
r"""
Ignore all spans that occur within highlighted blocks
@@ -1095,7 +1121,7 @@ class docutilsHTMLProcessor(genericHTMLP
def reset(self):
r"""
Initialize necessary variables. Called by
- :meth:`SGMLParser.__init__`.
+ :meth:`HTMLParser.__init__`.
EXAMPLES::
@@ -1125,8 +1151,8 @@ class docutilsHTMLProcessor(genericHTMLP
# counters
self.cellcount = 0
-
- SGMLParser.reset(self)
+
+ HTMLParser.reset(self)
def false_positive_input_output_cell(self, cell_piece):
r"""
@@ -1162,7 +1188,7 @@ class docutilsHTMLProcessor(genericHTMLP
piece = piece.replace('}','} ')
piece += '\n
'
return piece
-
+
#############################################
## Specific tag handlers
##
--- build/pkgs/sagenb/src/sagenb/notebook/notebook.py.orig 2018-05-22 10:16:28.000000000 -0600
+++ build/pkgs/sagenb/src/sagenb/notebook/notebook.py 2018-10-25 13:35:37.122921027 -0600
@@ -1268,7 +1268,7 @@ class Notebook(object):
W.set_not_computing()
def quit(self):
- for W in self.__worksheets.values():
+ for W in list(self.__worksheets.values()):
W.quit()
def update_worksheet_processes(self):
--- build/pkgs/sagetex/src/extractsagecode.py.orig 2015-08-26 17:28:42.000000000 -0600
+++ build/pkgs/sagetex/src/extractsagecode.py 2018-10-25 13:36:23.465787905 -0600
@@ -45,8 +45,8 @@ See the SageTeX documentation for more d
try:
opts, args = getopt.getopt(sys.argv[1:], 'ho', ['help', 'overwrite'])
-except getopt.GetoptError, err:
- print str(err)
+except getopt.GetoptError as err:
+ print(str(err))
usage()
sys.exit(2)
--- build/pkgs/sagetex/src/makestatic.py.orig 2015-08-26 17:28:42.000000000 -0600
+++ build/pkgs/sagetex/src/makestatic.py 2018-10-25 13:36:41.193736977 -0600
@@ -45,8 +45,8 @@ See the SageTeX documentation for more d
try:
opts, args = getopt.getopt(sys.argv[1:], 'ho', ['help', 'overwrite'])
-except getopt.GetoptError, err:
- print str(err)
+except getopt.GetoptError as err:
+ print(str(err))
usage()
sys.exit(2)
--- build/pkgs/sagetex/src/remote-sagetex.py.orig 2015-08-26 17:28:42.000000000 -0600
+++ build/pkgs/sagetex/src/remote-sagetex.py 2018-10-25 13:38:40.218395127 -0600
@@ -24,12 +24,11 @@
## You should have received a copy of the GNU General Public License along
## with this program. If not, see .
##
-from __future__ import print_function
import json
import sys
import time
import re
-import urllib
+import urllib.request, urllib.parse, urllib.error
import hashlib
import os
import os.path
@@ -156,7 +155,7 @@ class RemoteSage:
'\n*(?P