Permalink
Browse files

Merge tag '0.11.7' into release

  • Loading branch information...
2 parents 8faa464 + 17148af commit 267e39d4073d37d961637a0843e658d022296e4a @kcrisman kcrisman committed Feb 23, 2016
View
@@ -1,3 +1,8 @@
+0.11.7 Feb 23 2016
+ - change imports for Sage changes
+ - small documentation fixes
+ - use new Sage documentation variables
+
0.11.6.1 Dec 14 2015
- fix doctests
View
@@ -101,7 +101,7 @@ in your local `SAGENB_ROOT`.
```sh
cd SAGE_ROOT
echo "<version>" > build/pkgs/sagenb/package-version.txt
- ./sage -sh -c sage-fix-pkg-checksums
+ ./sage --fix-pkg-checksums
./sage -tp --long --sagenb # test sagenb
make ptestlong # test sage
```
@@ -8,14 +8,11 @@
from flask_oldsessions import OldSecureCookieSessionInterface
from flask.ext.autoindex import AutoIndex
-try:
- from sage.env import SAGE_SRC
-except ImportError:
- SAGE_SRC = os.environ.get('SAGE_SRC', os.path.join(os.environ['SAGE_ROOT'], 'devel', 'sage'))
+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 sagenb.misc.misc import SAGENB_ROOT, DATA, SAGE_DOC, translations_path, N_, nN_, unicode_str
+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
from sagenb.notebook.template import (css_escape, clean_name,
@@ -53,10 +50,9 @@ def __init__(self, *args, **kwds):
# Doc #
#######
#These "should" be in doc.py
- DOC = os.path.join(SAGE_DOC, 'output', 'html', 'en')
- self.add_static_path('/pdf', os.path.join(SAGE_DOC, 'output', 'pdf'))
+ DOC = os.path.join(SAGE_DOC, 'html', 'en')
+ self.add_static_path('/pdf', os.path.join(SAGE_DOC, 'pdf'))
self.add_static_path('/doc/static', DOC)
- #self.add_static_path('/doc/static/reference', os.path.join(SAGE_DOC, 'reference'))
# Template globals
self.add_template_global(url_for)
@@ -22,8 +22,8 @@
doc = Module('sagenb.flask_version.doc')
-from sagenb.misc.misc import SAGE_DOC
-DOC = os.path.join(SAGE_DOC, 'output', 'html', 'en')
+from sage.env import SAGE_DOC
+DOC = os.path.join(SAGE_DOC, 'html', 'en')
################
# Static paths #
View
@@ -123,13 +123,18 @@ def find_next_available_port(interface, start, max_tries=100, verbose=False):
sage: find_next_available_port('127.0.0.1', 9000, verbose=False) # random output -- depends on network
9002
"""
+ from signal import alarm
+
alarm_count = 0
for port in range(start, start+max_tries+1):
try:
- alarm(5)
- s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- s.connect((interface, port))
- except socket.error, msg:
+ try:
+ alarm(5)
+ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ s.connect((interface, port))
+ finally:
+ alarm(0) # cancel alarm
+ except socket.error as msg:
if msg[1] == 'Connection refused':
if verbose: print "Using port = %s"%port
return port
@@ -138,9 +143,6 @@ def find_next_available_port(interface, start, max_tries=100, verbose=False):
alarm_count += 1
if alarm_count >= 10:
break
- pass
- finally:
- cancel_alarm()
if verbose:
print "Port %s is already in use."%port
print "Trying next port..."
@@ -188,11 +190,7 @@ def pad_zeros(s, size=3):
except ImportError:
SAGE_URL = 'http://sagemath.org'
-try:
- from sage.env import SAGE_DOC
-except ImportError:
- SAGE_DOC = "stub"
-
+
# TODO: Get macros from server and user settings.
try:
import sage.all
@@ -260,16 +258,10 @@ def save(obj, filename):
open(filename,'wb').write(s)
try:
- from sage.misc.all import alarm, cancel_alarm, verbose
+ from sage.misc.all import verbose
except ImportError:
# TODO!
@stub
- def alarm(*args, **kwds):
- pass
- @stub
- def cancel_alarm(*args, **kwds):
- pass
- @stub
def verbose(*args, **kwds):
pass
@@ -353,15 +345,7 @@ def is_Matrix(x):
return False
return is_Matrix(x)
-try:
- from sage.misc.all import srange
-except ImportError:
- # TODO: need to put a really srange here!
- def srange(start, end=None, step=1, universe=None, check=True, include_endpoint=False, endpoint_tolerance=1e-5):
- v = [start]
- while v[-1] <= end:
- v.append(v[-1]+step)
- return v
+from sage.all import srange
def register_with_cleaner(pid):
View
@@ -24,10 +24,7 @@
# We import Sphinx on demand, to reduce Sage startup time.
Sphinx = None
-try:
- from sage.env import SAGE_DOC
-except ImportError:
- SAGE_DOC = '' # used to be None
+from sage.env import SAGE_DOC_SRC
def is_sphinx_markup(docstring):
@@ -104,8 +101,8 @@ def sphinxify(docstring, format='html'):
# Sphinx constructor: Sphinx(srcdir, confdir, outdir, doctreedir,
# buildername, confoverrides, status, warning, freshenv).
temp_confdir = False
- confdir = os.path.join(SAGE_DOC, 'en', 'introspect')
- if not SAGE_DOC and not os.path.exists(confdir):
+ confdir = os.path.join(SAGE_DOC_SRC, 'en', 'introspect')
+ if not SAGE_DOC_SRC and not os.path.exists(confdir):
# If we don't have Sage, we need to do our own configuration
# This may be inefficient or broken. TODO: Find a faster way to do this.
temp_confdir = True
@@ -598,7 +595,7 @@ def setup(app):
'''
- # From SAGE_DOC/en/introspect/templates/layout.html:
+ # From SAGE_DOC_SRC/en/introspect/templates/layout.html:
layout = r"""
<div class="docstring">
{% block body %}{% endblock %}
@@ -150,6 +150,7 @@
import inspect
import math
import types
+import collections
from base64 import standard_b64decode
# Sage libraries
@@ -2333,15 +2334,6 @@ def interact(f, layout=None, width='800px'):
... print factor(Integer(n))
<html>...
- You do not have to use interact as a decorators; you can also
- simply write ``interact(f)`` where ``f`` is any Python function
- that you have defined, though this is frowned upon. E.g., ``f``
- can also be a library function as long as it is written in
- Python::
-
- sage: interact(matrix) # put ZZ, 2,2,[1..4] in boxes...
- <html>...
-
If your the time to evaluate your function takes awhile, you may
not want to have it reevaluated every time the inputs change. In
order to prevent this, you can add a keyword ``auto_update=False`` to
@@ -2422,7 +2414,8 @@ def interact(f, layout=None, width='800px'):
* ``u = list`` - buttons if ``len(list)`` at most `5`;
otherwise, drop down
- * ``u = generator`` - a slider (up to `10000` steps)
+ * ``u = iterator`` (e.g. a generator) - a slider (up to `10000`
+ steps)
* ``u = bool`` - a checkbox
@@ -3742,7 +3735,7 @@ def automatic_control(default):
for _ in range(2):
if isinstance(default, tuple) and len(default) == 2 and isinstance(default[0], str):
label, default = default
- if isinstance(default, tuple) and len(default) == 2 and isinstance(default[1], (tuple, list, types.GeneratorType)):
+ if isinstance(default, tuple) and len(default) == 2 and isinstance(default[1], (tuple, list, collections.Iterator)):
default_value, default = default
if isinstance(default, control):
@@ -3755,7 +3748,7 @@ def automatic_control(default):
C = input_box(default, label=label, type=bool)
elif isinstance(default, list):
C = selector(default, default=default_value, label=label, buttons=len(default) <= 5)
- elif isinstance(default, types.GeneratorType):
+ elif isinstance(default, collections.Iterator):
C = slider(list_of_first_n(default, 10000), default=default_value, label=label)
elif isinstance(default, Color):
C = input_box(default, label=label, type=Color)
@@ -38,8 +38,7 @@
import locale
# General sage library code
-from sagenb.misc.misc import (cython, load, save,
- alarm, cancel_alarm, verbose, DOT_SAGENB,
+from sagenb.misc.misc import (cython, load, save, verbose, DOT_SAGENB,
walltime, ignore_nonexistent_files,
set_restrictive_permissions,
set_permissive_permissions,
View
@@ -4,8 +4,11 @@
from sage.misc.sage_timeit import sage_timeit
-from sage.misc.all import alarm, cancel_alarm
from sagenb.misc.misc import walltime, cputime
+from signal import alarm
+
+def cancel_alarm():
+ alarm(0)
TIMEOUT = 'timeout'
View
4 setup.py 100644 → 100755
@@ -1,3 +1,5 @@
+#!/usr/bin/env python
+
##########################################################
# The setup.py for the Sage Notebook
##########################################################
@@ -44,7 +46,7 @@ def all_files(dir, prefix):
distutils.log.set_threshold(distutils.log.DEBUG)
code = setup(name = 'sagenb',
- version = '0.11.6.1',
+ version = '0.11.7',
description = 'The Sage Notebook',
license = 'GNU General Public License (GPL) v3+',
author = 'William Stein et al.',

0 comments on commit 267e39d

Please sign in to comment.