Menu

#301 sphinx fails to generate html when using remote images with docutils 0.13

closed-fixed
nobody
sphinx (1)
5
2020-03-03
2016-12-11
No

docutils 0.13.1 breaks on remote images

Steps to reproduce:

$ git clone https://github.com/openstack/tripleo-common.git
$ vim README.rst # (remove the :remote: tag)
$ tox -edocs

Line 903 (body of depart_image) is commented here: https://sourceforge.net/p/docutils/code/HEAD/tree/trunk/docutils/docutils/writers/_html_base.py

Uncommenting that line seems to fix the problem. This has broken several CI jobs for us (OpenStack) as it used to work in previous versions (0.12.0).

Traceback (most recent call last):
  File "setup.py", line 29, in <module>
    pbr=True)
  File "/usr/lib64/python3.5/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/usr/lib64/python3.5/distutils/dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "/usr/lib64/python3.5/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/home/flaper87/workspace/openstack/tripleo-common/.tox/docs/lib/python3.5/site-packages/pbr/builddoc.py", line 198, in run
    setup_command.BuildDoc.run(self)
  File "/home/flaper87/workspace/openstack/tripleo-common/.tox/docs/lib/python3.5/site-packages/sphinx/setup_command.py", line 164, in run
    app.build(force_all=self.all_files)
  File "/home/flaper87/workspace/openstack/tripleo-common/.tox/docs/lib/python3.5/site-packages/sphinx/application.py", line 261, in build
    self.builder.build_all()
  File "/home/flaper87/workspace/openstack/tripleo-common/.tox/docs/lib/python3.5/site-packages/sphinx/builders/__init__.py", line 211, in build_all
    self.build(None, summary='all source files', method='all')
  File "/home/flaper87/workspace/openstack/tripleo-common/.tox/docs/lib/python3.5/site-packages/sphinx/builders/__init__.py", line 322, in build
    self.write(docnames, list(updated_docnames), method)
  File "/home/flaper87/workspace/openstack/tripleo-common/.tox/docs/lib/python3.5/site-packages/sphinx/builders/__init__.py", line 360, in write
    self._write_serial(sorted(docnames), warnings)
  File "/home/flaper87/workspace/openstack/tripleo-common/.tox/docs/lib/python3.5/site-packages/sphinx/builders/__init__.py", line 368, in _write_serial
    self.write_doc(docname, doctree)
  File "/home/flaper87/workspace/openstack/tripleo-common/.tox/docs/lib/python3.5/site-packages/sphinx/builders/html.py", line 443, in write_doc
    self.docwriter.write(doctree, destination)
  File "/home/flaper87/workspace/openstack/tripleo-common/.tox/docs/lib/python3.5/site-packages/docutils/writers/__init__.py", line 80, in write
    self.translate()
  File "/home/flaper87/workspace/openstack/tripleo-common/.tox/docs/lib/python3.5/site-packages/sphinx/writers/html.py", line 53, in translate
    self.document.walkabout(visitor)
  File "/home/flaper87/workspace/openstack/tripleo-common/.tox/docs/lib/python3.5/site-packages/docutils/nodes.py", line 187, in walkabout
    visitor.dispatch_departure(self)
  File "/home/flaper87/workspace/openstack/tripleo-common/.tox/docs/lib/python3.5/site-packages/docutils/nodes.py", line 1895, in dispatch_departure
    return method(node)
  File "/home/flaper87/workspace/openstack/tripleo-common/.tox/docs/lib/python3.5/site-packages/docutils/writers/_html_base.py", line 671, in depart_document
    assert not self.context, 'len(context) = %s' % len(self.context)
AssertionError: len(context) = 1
ERROR: InvocationError: '/home/flaper87/workspace/openstack/tripleo-common/.tox/docs/bin/python setup.py build_sphinx'

Discussion

  • Hervé Cauwelier

    Hi,

    I was going to report the same issue but in fact it happens with local SVG files and the traceback is not exactly the same. I only get it within a Sphinx environment with references to SVG images.

    Example with test.rst:

    .. image:: test.svg
    

    The SVG file itself is just empty, a "touch test.svg".

    Then I create a Sphinx environment using "sphinx-quickstart".

    With "make html", I get the traceback I attach to my comment.

    If I comment the ".. image::" directive, or if I install "docutils==0.12", the issue disappears and the docs compile fine.

     
  • Takeshi KOMIYA

    Takeshi KOMIYA - 2016-12-12

    This was already fixed at sphinx side.
    https://github.com/sphinx-doc/sphinx/issues/3212

    This is not a bug of docutils, I believe.

     
  • Günter Milde

    Günter Milde - 2016-12-13
    • labels: --> sphinx
    • summary: docutils fails to generate html when using remote images --> sphinx fails to generate html when using remote images with docutils 0.13
    • status: open --> closed-fixed
     
  • Günter Milde

    Günter Milde - 2016-12-13

    Fixed by Sphinx 1.5.1 released today. Closing now.

     

    Last edit: Günter Milde 2016-12-13

Log in to post a comment.