[arch-commits] Commit in sagemath-doc/trunk (3 files)

Antonio Rojas arojas at archlinux.org
Sat Apr 18 21:13:30 UTC 2020


    Date: Saturday, April 18, 2020 @ 21:13:29
  Author: arojas
Revision: 616169

Fix build with sphinx 3

Added:
  sagemath-doc/trunk/sagemath-doc-sphinx-3.patch
  sagemath-doc/trunk/sagemath-matplotlib-3.2.patch
Modified:
  sagemath-doc/trunk/PKGBUILD

-------------------------------+
 PKGBUILD                      |   19 ++-
 sagemath-doc-sphinx-3.patch   |  227 ++++++++++++++++++++++++++++++++++++++++
 sagemath-matplotlib-3.2.patch |   62 ++++++++++
 3 files changed, 303 insertions(+), 5 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2020-04-18 20:55:19 UTC (rev 616168)
+++ PKGBUILD	2020-04-18 21:13:29 UTC (rev 616169)
@@ -2,21 +2,26 @@
 
 pkgname=sagemath-doc
 pkgver=9.0
-pkgrel=2
+pkgrel=3
 pkgdesc="HTML documentation for SageMath"
 arch=(any)
 url="http://www.sagemath.org"
 license=(GPL)
 depends=(gap-doc python-pplpy)
-makedepends=(sagemath python-pyzmq python-docutils python-jupyter_client python-pkgconfig cython python-ipywidgets python-sphinx-1 thebe)
+makedepends=(sagemath python-pyzmq python-docutils python-jupyter_client python-pkgconfig cython python-ipywidgets thebe)
 source=(sagemath-$pkgver.tar.gz::"https://github.com/sagemath/sage/archive/$pkgver.tar.gz"
         docbuild_main.patch
         sagemath-ecl-sigfpe.patch
-        sphinxify-warnings.patch)
+        sphinxify-warnings.patch
+        sagemath-matplotlib-3.2.patch
+        sagemath-doc-sphinx-3.patch)
 sha256sums=('6f5d42b306a2c03073dd95086f80602bd1a0b929b8ad19c6d219c8ca8e96da26'
             'ea5e17bb7a7cb36a22e5e3872fcc2585852bc971c4b139b0b2cd69a36c1b009b'
             'e44bbde87f3312548faad75b7383ef21fade55be251ab5804de41cd3842ca8a0'
-            '99fc7f393d5ee2687573c0ef6bf5ecb75077e415aa0605af3766824fa11aafd6')
+            '99fc7f393d5ee2687573c0ef6bf5ecb75077e415aa0605af3766824fa11aafd6'
+            '979777363001cca87f73128dd4db5f372fc9e4f1079805a20af01df47797468f'
+            '57dc8b1d2adb2bde9896edc2d123149897390af5c13d5fe02cc175850305200c')
+options=(!strip)
 
 prepare() {
   cd sage-$pkgver
@@ -30,6 +35,10 @@
   patch -p1 -i ../sagemath-ecl-sigfpe.patch
 # Fix sphinxify deprecation warnings
   patch -p1 -i ../sphinxify-warnings.patch
+# Fix warnings with matplotlib 3.2
+  patch -p1 -i ../sagemath-matplotlib-3.2.patch
+# Fix build with sphinx 3.0
+  patch -p1 -i ../sagemath-doc-sphinx-3.patch
 }
 
 build() {
@@ -43,7 +52,7 @@
          MATHJAX_DIR="/usr/share/mathjax2" \
          PYTHONPATH="$srcdir"/sage-$pkgver/local-python \
          SAGE_NUM_THREADS=10
-  python sage_setup/docbuild --no-pdf-links --mathjax all html
+  python sage_setup/docbuild --no-pdf-links --mathjax all html -k
 }
 
 package() {

Added: sagemath-doc-sphinx-3.patch
===================================================================
--- sagemath-doc-sphinx-3.patch	                        (rev 0)
+++ sagemath-doc-sphinx-3.patch	2020-04-18 21:13:29 UTC (rev 616169)
@@ -0,0 +1,227 @@
+--- a/src/sage_setup/docbuild/__init__.py
++++ b/src/sage_setup/docbuild/__init__.py
+@@ -817,9 +817,13 @@ class ReferenceSubBuilder(DocBuilder):
+ 
+         env_pickle = os.path.join(self._doctrees_dir(), 'environment.pickle')
+         try:
+-            env = BuildEnvironment.frompickle(env_pickle, FakeApp(self.dir))
+-            logger.debug("Opened Sphinx environment: %s", env_pickle)
+-            return env
++            with open(env_pickle, 'rb') as f:
++                import pickle
++                env = pickle.load(f)
++                env.app = FakeApp(self.dir)
++                env.config.values = env.app.config.values
++                logger.debug("Opened Sphinx environment: %s", env_pickle)
++                return env
+         except IOError as err:
+             logger.debug("Failed to open Sphinx environment: %s", err)
+ 
+--- a/src/sage/docs/conf.py
++++ b/src/sage/docs/conf.py
+@@ -8,6 +8,7 @@ from docutils import nodes
+ from docutils.transforms import Transform
+ from sphinx.ext.doctest import blankline_re
+ from sphinx import highlighting
++import sphinx.ext.intersphinx as intersphinx
+ from IPython.lib.lexers import IPythonConsoleLexer, IPyLexer
+ 
+ # If your extensions are in another directory, add it here.
+@@ -169,13 +169,8 @@ todo_include_todos = True
+ 
+ # Cross-links to other project's online documentation.
+ python_version = sys.version_info.major
+-intersphinx_mapping = {
+-    'python': ('https://docs.python.org/',
+-                os.path.join(SAGE_DOC_SRC, "common",
+-                             "python{}.inv".format(python_version))),
+-    'pplpy': (PPLPY_DOCS, None)}
+ 
+-def set_intersphinx_mappings(app):
++def set_intersphinx_mappings(app, config):
+     """
+     Add precompiled inventory (the objects.inv)
+     """
+@@ -186,7 +182,11 @@ def set_intersphinx_mappings(app):
+         app.config.intersphinx_mapping = {}
+         return
+ 
+-    app.config.intersphinx_mapping = intersphinx_mapping
++    app.config.intersphinx_mapping =  {
++    'python': ('https://docs.python.org/',
++                os.path.join(SAGE_DOC_SRC, "common",
++                             "python{}.inv".format(python_version))),
++    'pplpy': (PPLPY_DOCS, None)}
+ 
+     # Add master intersphinx mapping
+     dst = os.path.join(invpath, 'objects.inv')
+@@ -201,6 +201,7 @@ def set_intersphinx_mappings(app):
+             dst = os.path.join(invpath, directory, 'objects.inv')
+             app.config.intersphinx_mapping[src] = dst
+ 
++    intersphinx.normalize_intersphinx_mapping(app, config)
+ 
+ # By default document are not master.
+ multidocs_is_master = True
+@@ -669,7 +672,7 @@ def call_intersphinx(app, env, node, contnode):
+     """
+     debug_inf(app, "???? Trying intersphinx for %s" % node['reftarget'])
+     builder = app.builder
+-    res =  sphinx.ext.intersphinx.missing_reference(
++    res =  intersphinx.missing_reference(
+         app, env, node, contnode)
+     if res:
+         # Replace absolute links to $SAGE_DOC by relative links: this
+@@ -852,11 +855,10 @@ def setup(app):
+     if app.srcdir.startswith(SAGE_DOC_SRC):
+         app.add_config_value('intersphinx_mapping', {}, False)
+         app.add_config_value('intersphinx_cache_limit', 5, False)
++        app.connect('config-inited', set_intersphinx_mappings)
++        app.connect('builder-inited', intersphinx.load_mappings)
+         # We do *not* fully initialize intersphinx since we call it by hand
+         # in find_sage_dangling_links.
+         #   app.connect('missing-reference', missing_reference)
+         app.connect('missing-reference', find_sage_dangling_links)
+-        import sphinx.ext.intersphinx
+-        app.connect('builder-inited', set_intersphinx_mappings)
+-        app.connect('builder-inited', sphinx.ext.intersphinx.load_mappings)
+         app.connect('builder-inited', nitpick_patch_config)
+--- a/src/sage_setup/docbuild/ext/multidocs.py
++++ b/src/sage_setup/docbuild/ext/multidocs.py
+@@ -47,32 +47,39 @@ def merge_environment(app, env):
+     - domaindata['py']['modules'] # list of python modules
+     """
+     logger.info(bold('Merging environment/index files...'))
++    if not hasattr(env, "todo_all_todos"):
++        env.todo_all_todos = []
++    if not env.domaindata['citation'].get('citations'):
++        env.domaindata['citation']['citations'] = dict()
+     for curdoc in app.env.config.multidocs_subdoc_list:
+         logger.info("    %s:"%curdoc, nonl=1)
+         docenv = get_env(app, curdoc)
+         if docenv is not None:
+             fixpath = lambda path: os.path.join(curdoc, path)
++            todos = docenv.todo_all_todos if hasattr(docenv, "todo_all_todos") else []
++            citations = docenv.domaindata['citation'].get('citations', dict())
++            indexentries = docenv.domaindata['index'].get('entries', dict())
+             logger.info(" %s todos, %s index, %s citations"%(
+-                    len(docenv.todo_all_todos),
+-                    len(docenv.indexentries),
+-                    len(docenv.domaindata["std"]["citations"])
++                    len(todos),
++                    len(indexentries),
++                    len(citations)
+                     ), nonl=1)
+ 
+             # merge titles
+             for t in docenv.titles:
+                 env.titles[fixpath(t)] = docenv.titles[t]
+             # merge the todo links
+-            for dct in docenv.todo_all_todos:
++            for dct in todos:
+                 dct['docname'] = fixpath(dct['docname'])
+-            env.todo_all_todos += docenv.todo_all_todos
++            env.todo_all_todos += todos
+             # merge the html index links
+             newindex = {}
+-            for ind in docenv.indexentries:
++            for ind in indexentries:
+                 if ind.startswith('sage/'):
+-                    newindex[fixpath(ind)] = docenv.indexentries[ind]
++                    newindex[fixpath(ind)] = indexentries[ind]
+                 else:
+-                    newindex[ind] = docenv.indexentries[ind]
+-            env.indexentries.update(newindex)
++                    newindex[ind] = indexentries[ind]
++            env.domaindata['index']['entries'].update(newindex)
+             # merge the all_docs links, needed by the js index
+             newalldoc = {}
+             for ind in docenv.all_docs:
+@@ -86,24 +93,23 @@ def merge_environment(app, env):
+                 env.metadata[ind] = md
+             # merge the citations
+             newcite = {}
+-            citations = docenv.domaindata["std"]["citations"]
+-            for ind, (path, tag, lineno) in six.iteritems(docenv.domaindata["std"]["citations"]):
++            for ind, (path, tag, lineno) in six.iteritems(citations):
+                 # TODO: Warn on conflicts
+                 newcite[ind] = (fixpath(path), tag, lineno)
+-            env.domaindata["std"]["citations"].update(newcite)
++            env.domaindata['citation']['citations'].update(newcite)
+             # merge the py:module indexes
+             newmodules = {}
+-            for ind,(modpath,v1,v2,v3) in (
++            for ind,(modpath,v1,v2,v3,v4) in (
+                 six.iteritems(docenv.domaindata['py']['modules'])):
+-                newmodules[ind] = (fixpath(modpath),v1,v2,v3)
++                newmodules[ind] = (fixpath(modpath),v1,v2,v3,v4)
+             env.domaindata['py']['modules'].update(newmodules)
+             logger.info(", %s modules"%(len(newmodules)))
+     logger.info('... done (%s todos, %s index, %s citations, %s modules)'%(
+             len(env.todo_all_todos),
+-            len(env.indexentries),
+-            len(env.domaindata["std"]["citations"]),
++            len(env.domaindata['index']['entries']),
++            len(env.domaindata['citation']['citations']),
+             len(env.domaindata['py']['modules'])))
+-    write_citations(app, env.domaindata["std"]["citations"])
++    write_citations(app, env.domaindata['citation']['citations'])
+ 
+ 
+ def get_env(app, curdoc):
+@@ -253,7 +259,7 @@ def fetch_citation(app, env):
+     with open(filename, 'rb') as f:
+         cache = cPickle.load(f)
+     logger.info("done (%s citations)."%len(cache))
+-    cite = env.domaindata["std"]["citations"]
++    cite = env.domaindata['citation']['citations']
+     for ind, (path, tag, lineno) in six.iteritems(cache):
+         if ind not in cite: # don't override local citation
+             cite[ind] = (os.path.join("..", path), tag, lineno)
+--- a/src/sage_setup/docbuild/ext/sage_autodoc.py
++++ b/src/sage_setup/docbuild/ext/sage_autodoc.py
+@@ -35,14 +35,15 @@ import sys
+ from docutils.statemachine import ViewList
+ 
+ import sphinx
+-from sphinx.ext.autodoc.importer import mock, import_object, get_object_members
++from sphinx.ext.autodoc import mock
++from sphinx.ext.autodoc.importer import import_object, get_object_members, get_module_members
+ from sphinx.locale import _, __
+ from sphinx.pycode import ModuleAnalyzer
+ from sphinx.errors import PycodeError
+ from sphinx.util import logging
+ from sphinx.util import rpartition, force_decode
+ from sphinx.util.docstrings import prepare_docstring
+-from sphinx.util.inspect import isdescriptor, safe_getmembers, \
++from sphinx.util.inspect import isdescriptor, \
+     safe_getattr, object_description, is_builtin_class_method, \
+     isenumattribute, isclassmethod, isstaticmethod, getdoc
+ 
+@@ -536,7 +537,7 @@ class Documenter(object):
+ 
+         # add content from docstrings
+         if not no_docstring:
+-            encoding = self.analyzer and self.analyzer.encoding
++            encoding = self.analyzer and self.analyzer._encoding
+             docstrings = self.get_doc(encoding)
+             if not docstrings:
+                 # append at least a dummy docstring, so that the event
+@@ -882,7 +883,7 @@ class ModuleDocumenter(Documenter):
+             if not hasattr(self.object, '__all__'):
+                 # for implicit module members, check __module__ to avoid
+                 # documenting imported objects
+-                return True, safe_getmembers(self.object)
++                return True, get_module_members(self.object)
+             else:
+                 memberlist = self.object.__all__
+                 # Sometimes __all__ is broken...
+@@ -893,7 +894,7 @@ class ModuleDocumenter(Documenter):
+                         '(in module %s) -- ignoring __all__' %
+                         (memberlist, self.fullname))
+                     # fall back to all members
+-                    return True, safe_getmembers(self.object)
++                    return True, get_module_members(self.object)
+         else:
+             memberlist = self.options.members or []
+         ret = []

Added: sagemath-matplotlib-3.2.patch
===================================================================
--- sagemath-matplotlib-3.2.patch	                        (rev 0)
+++ sagemath-matplotlib-3.2.patch	2020-04-18 21:13:29 UTC (rev 616169)
@@ -0,0 +1,62 @@
+diff --git a/src/sage/plot/contour_plot.py b/src/sage/plot/contour_plot.py
+index a7533fa3d9..12a2b1f670 100644
+--- a/src/sage/plot/contour_plot.py
++++ b/src/sage/plot/contour_plot.py
+@@ -223,7 +223,7 @@ class ContourPlot(GraphicPrimitive):
+                 cb.add_lines(CS)
+ 
+ 
+- at suboptions('colorbar', orientation='vertical', format=None, spacing=None)
++ at suboptions('colorbar', orientation='vertical', format=None, spacing='uniform')
+ @suboptions('label', fontsize=9, colors='blue', inline=None, inline_spacing=3,
+             fmt="%1.2f")
+ @options(plot_points=100, fill=True, contours=None, linewidths=None,
+diff --git a/src/sage/plot/colors.py b/src/sage/plot/colors.py
+index 1860b6c948..af6fc7ec64 100644
+--- a/src/sage/plot/colors.py
++++ b/src/sage/plot/colors.py
+@@ -20,7 +20,7 @@ comprises the "official" W3C CSS3_ / SVG_ colors.
+ For a list of color maps in Sage, evaluate::
+ 
+     sage: sorted(colormaps)
+-    [u'Accent', u'Accent_r', u'Blues', u'Blues_r', u'BrBG', u'BrBG_r', ...]
++    [u'Accent', u'Blues', u'BrBG', ...]
+ 
+ These are imported from matplotlib's cm_ module.
+ 
+@@ -1374,7 +1374,7 @@ def get_cmap(cmap):
+     and color names.  For a list of map names, evaluate::
+ 
+         sage: sorted(colormaps)
+-        [u'Accent', u'Accent_r', u'Blues', u'Blues_r', ...]
++        [u'Accent', u'Blues', ...]
+ 
+     See :func:`rgbcolor` for valid list/tuple element formats.
+ 
+@@ -1468,7 +1468,7 @@ class Colormaps(collections.MutableMapping):
+     For a list of map names, evaluate::
+ 
+         sage: sorted(colormaps)
+-        [u'Accent', u'Accent_r', u'Blues', u'Blues_r', ...]
++        [u'Accent', u'Blues', ...]
+     """
+     def __init__(self):
+         """
+@@ -1495,7 +1495,7 @@ class Colormaps(collections.MutableMapping):
+             sage: len(maps.maps)
+             0
+             sage: maps.load_maps()
+-            sage: len(maps.maps)>130
++            sage: len(maps.maps)>65
+             True
+         """
+         global cm
+@@ -1539,7 +1539,7 @@ class Colormaps(collections.MutableMapping):
+ 
+             sage: from sage.plot.colors import Colormaps
+             sage: maps = Colormaps()
+-            sage: len(maps)>130
++            sage: len(maps)>65
+             True
+         """
+         self.load_maps()


More information about the arch-commits mailing list