Sphinx build script

This is Sage’s version of the sphinx-build script. We redirect stdout and stderr to our own logger, and remove some unwanted chatter.

class sage_docbuild.sphinxbuild.SageSphinxLogger(stream, prefix)[source]

Bases: object

This implements the file object interface to serve as sys.stdout/sys.stderr replacement.

ansi_escape_sequence = re.compile('\n        \\x1b    # ESC\n        \\[      # CSI sequence starts\n        [0-?]*  # parameter bytes\n        [ -/]*  # intermediate bytes\n        [@-~]   # final byte\n        ', re.VERBOSE)
ansi_escape_sequence_color = re.compile('\n        \\x1b    # ESC\n        \\[      # CSI sequence starts\n        [0-9;]* # parameter bytes\n                # intermediate bytes\n        m       # final byte\n        ', re.VERBOSE)
close()[source]
closed = False
encoding = None
flush()[source]
isatty()[source]
mode = 'w'
name = '<log>'
newlines = None
prefix_len = 9
raise_errors()[source]

Raise an exceptions if any errors have been found while parsing the Sphinx output.

EXAMPLES:

sage: from sys import stdout
sage: from sage_docbuild.sphinxbuild import SageSphinxLogger
sage: logger = SageSphinxLogger(stdout, "doctesting")
sage: logger._log_line("This is a SEVERE error\n")
[doctestin] This is a SEVERE error
sage: logger.raise_errors()
Traceback (most recent call last):
...
OSError: This is a SEVERE error
>>> from sage.all import *
>>> from sys import stdout
>>> from sage_docbuild.sphinxbuild import SageSphinxLogger
>>> logger = SageSphinxLogger(stdout, "doctesting")
>>> logger._log_line("This is a SEVERE error\n")
[doctestin] This is a SEVERE error
>>> logger.raise_errors()
Traceback (most recent call last):
...
OSError: This is a SEVERE error
from sys import stdout
from sage_docbuild.sphinxbuild import SageSphinxLogger
logger = SageSphinxLogger(stdout, "doctesting")
logger._log_line("This is a SEVERE error\n")
logger.raise_errors()
softspace = 0
write(str)[source]
writelines(sequence)[source]
sage_docbuild.sphinxbuild.runsphinx()[source]
sage_docbuild.sphinxbuild.term_width_line(text)[source]