Commit Graph

2 Commits

Author SHA1 Message Date
Ulf Magnusson 80c28dbf5e doc: sphinx: Fix broken import of lexer.DtsLexer
When sphinx-build is run under Python 2, running e.g. 'make html' in
doc/ currently causes the following error:

    Exception occurred:
      File "conf.py", line 128, in <module>
        from lexer.DtsLexer import DtsLexer
    ImportError: No module named lexer.DtsLexer

The problem is that doc/extensions/lexer/ contains no __init__.py file,
which prevents Python 2 from finding submodules in it[1].

The problem does not occur for Python 3, due to implicit namespaces
packages:
https://www.python.org/dev/peps/pep-0420/

Add an empty __init__.py to doc/extensions/lexer/ to fix building when
sphinx-build uses Python 2 (2.7 is still the version recommended on the
Sphinx homepage). This won't alter the behavior for Python 3.

(doc/extensions is added to the search path at the beginning of conf.py
and so doesn't need an __init__.py. doc/extensions/zephyr already has an
empty __init__.py.)

[1] https://docs.python.org/2/tutorial/modules.html#packages

Fixes #6851

Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
2018-03-29 08:16:04 -04:00
Bobby Noelte a5a29e4efc doc: sphinx: Add Pygment lexer for DTS
Add pygment lexer for DTS code-block.

Fixes #6029

Origin: skiboot, https://github.com/qemu/skiboot
Status:  91350c5a926795d8917a4eff699941361f780476
Description: Syntax highlighting of Device Tree Source (dts)
Dependencies: None
URL: https://github.com/qemu/skiboot/blob/master/doc/DtsLexer.py
commit: 91350c5a926795d8917a4eff699941361f780476
Maintained-by: External
License: BSL-1.0
License Link:
    https://github.com/qemu/skiboot/blob/master/doc/DtsLexer.py

Signed-off-by: Bobby Noelte <b0661n0e17e@gmail.com>
2018-03-23 08:16:49 -04:00