Skip to content

Commit

Permalink
Docbuild fixes for Sphinx 1.5.x
Browse files Browse the repository at this point in the history
  • Loading branch information
jdemeyer committed Mar 13, 2017
1 parent 879c401 commit 78e6718
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 39 deletions.
6 changes: 3 additions & 3 deletions src/sage/homology/simplicial_complex.py
Expand Up @@ -195,8 +195,8 @@ def lattice_paths(t1, t2, length=None):
:param length: if not ``None``, then an integer, the length of the desired
path.
:type length: integer or ``None``; optional, default ``None``
:type t1: tuple, list, other iterable
:type t2: tuple, list, other iterable
:type t1: list, other iterable
:type t2: list, other iterable
:return: list of lists of vertices making up the paths as described above
:rtype: list of lists
Expand Down Expand Up @@ -333,7 +333,7 @@ class Simplex(SageObject):
tuple of the vertices.
:param X: set of vertices
:type X: integer or list, tuple, or other iterable
:type X: integer, list, other iterable
:return: simplex with those vertices
``X`` may be a non-negative integer `n`, in which case the
Expand Down
28 changes: 0 additions & 28 deletions src/sage_setup/docbuild/__init__.py
Expand Up @@ -1578,32 +1578,6 @@ def fetch_inventory(self, app, uri, inv):
return i


def patch_domain_init():
"""
Applies a monkey-patch to the __init__ method of the Domain class in
Sphinx, in order to work around a bug.
See https://trac.sagemath.org/ticket/21044 as well as
https://github.com/sphinx-doc/sphinx/pull/2816 for details about that
bug.
"""

from sphinx.domains import Domain
import copy

orig_init = Domain.__init__

def __init__(self, *args, **kwargs):
orig_init(self, *args, **kwargs)

# Replace the original initial_data class attribute with a new
# deep-copy of itself, since the bug will cause the original
# initial_data to be modified in-place
self.__class__.initial_data = copy.deepcopy(self.initial_data)

Domain.__init__ = __init__


def main():
# Parse the command-line.
parser = setup_parser()
Expand Down Expand Up @@ -1653,8 +1627,6 @@ def main():

ABORT_ON_ERROR = not options.keep_going

patch_domain_init()

# Delete empty directories. This is needed in particular for empty
# directories due to "git checkout" which never deletes empty
# directories it leaves behind. See Trac #20010.
Expand Down
18 changes: 10 additions & 8 deletions src/sage_setup/docbuild/ext/multidocs.py
Expand Up @@ -3,8 +3,6 @@
multi documentation in Sphinx
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is a slightly hacked-up version of the Sphinx-multidoc plugin
The goal of this extension is to manage a multi documentation in Sphinx.
To be able to compile Sage's huge documentation in parallel, the
documentation is cut into a bunch of independent documentations called
Expand Down Expand Up @@ -57,7 +55,7 @@ def merge_environment(app, env):
app.info(" %s todos, %s index, %s citations"%(
len(docenv.todo_all_todos),
len(docenv.indexentries),
len(docenv.citations)
len(docenv.domaindata["std"]["citations"])
), nonl=1)

# merge titles
Expand Down Expand Up @@ -88,10 +86,10 @@ def merge_environment(app, env):
env.metadata[ind] = md
# merge the citations
newcite = {}
for ind, (path, tag) in six.iteritems(docenv.citations):
for ind, (path, tag) in six.iteritems(docenv.domaindata["std"]["citations"]):
# TODO: Warn on conflicts
newcite[ind] = (fixpath(path), tag)
env.citations.update(newcite)
env.domaindata["std"]["citations"].update(newcite)
# merge the py:module indexes
newmodules = {}
for ind,(modpath,v1,v2,v3) in (
Expand All @@ -102,9 +100,9 @@ def merge_environment(app, env):
app.info('... done (%s todos, %s index, %s citations, %s modules)'%(
len(env.todo_all_todos),
len(env.indexentries),
len(env.citations),
len(env.domaindata["std"]["citations"]),
len(env.domaindata['py']['modules'])))
write_citations(app, env.citations)
write_citations(app, env.domaindata["std"]["citations"])

def get_env(app, curdoc):
"""
Expand Down Expand Up @@ -146,6 +144,10 @@ def merge_js_index(app):
titles = app.builder.indexer._titles
for (res, title) in six.iteritems(index._titles):
titles[fixpath(res)] = title
# merge the filenames
filenames = app.builder.indexer._filenames
for (res, filename) in six.iteritems(index._filenames):
filenames[fixpath(res)] = filename
# TODO: merge indexer._objtypes, indexer._objnames as well

# Setup source symbolic links
Expand Down Expand Up @@ -244,7 +246,7 @@ def fetch_citation(app, env):
with open(filename, 'rb') as f:
cache = cPickle.load(f)
app.builder.info("done (%s citations)."%len(cache))
cite = env.citations
cite = env.domaindata["std"]["citations"]
for ind, (path, tag) in six.iteritems(cache):
if ind not in cite: # don't override local citation
cite[ind]=(os.path.join("..", path), tag)
Expand Down

0 comments on commit 78e6718

Please sign in to comment.