diff options
author | Nicolas Dechesne <nicolas.dechesne@linaro.org> | 2020-09-18 10:14:14 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-09-22 09:58:50 +0100 |
commit | a69d74c842a0f55ffa1408fa058138ac9637a0c6 (patch) | |
tree | 627d569efd58720c2fe8478d7d624cb83d76db3d /documentation | |
parent | d6ce950527981cf468f7091e5937333ad080e8b6 (diff) | |
download | poky-a69d74c842a0f55ffa1408fa058138ac9637a0c6.tar.gz |
sphinx: report errors when dependencies are not met
To build the Sphinx documentation, we have the following dependencies:
* sphinx
* sphinx_rtd_theme
* pyyaml
If any of these dependencies are missing, we might end up with some
cryptic error messages. This patch adds better error reporting when
dependencies are not met.
(From yocto-docs rev: 19df8d1ec56dc2ecb44122288cc53e84237fab69)
Signed-off-by: Nicolas Dechesne <nicolas.dechesne@linaro.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'documentation')
-rw-r--r-- | documentation/Makefile.sphinx | 4 | ||||
-rw-r--r-- | documentation/conf.py | 14 | ||||
-rw-r--r-- | documentation/sphinx/yocto-vars.py | 11 |
3 files changed, 24 insertions, 5 deletions
diff --git a/documentation/Makefile.sphinx b/documentation/Makefile.sphinx index c663c29540..c9518558bb 100644 --- a/documentation/Makefile.sphinx +++ b/documentation/Makefile.sphinx | |||
@@ -9,6 +9,10 @@ SOURCEDIR = . | |||
9 | BUILDDIR = _build | 9 | BUILDDIR = _build |
10 | DESTDIR = final | 10 | DESTDIR = final |
11 | 11 | ||
12 | ifeq ($(shell if which $(SPHINXBUILD) >/dev/null 2>&1; then echo 1; else echo 0; fi),0) | ||
13 | $(error "The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed") | ||
14 | endif | ||
15 | |||
12 | # Put it first so that "make" without argument is like "make help". | 16 | # Put it first so that "make" without argument is like "make help". |
13 | help: | 17 | help: |
14 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | 18 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
diff --git a/documentation/conf.py b/documentation/conf.py index 34d1bc97a4..f2dd2556fa 100644 --- a/documentation/conf.py +++ b/documentation/conf.py | |||
@@ -91,10 +91,16 @@ intersphinx_mapping = { | |||
91 | # The theme to use for HTML and HTML Help pages. See the documentation for | 91 | # The theme to use for HTML and HTML Help pages. See the documentation for |
92 | # a list of builtin themes. | 92 | # a list of builtin themes. |
93 | # | 93 | # |
94 | html_theme = 'sphinx_rtd_theme' | 94 | try: |
95 | html_theme_options = { | 95 | import sphinx_rtd_theme |
96 | 'sticky_navigation': False, | 96 | html_theme = 'sphinx_rtd_theme' |
97 | } | 97 | html_theme_options = { |
98 | 'sticky_navigation': False, | ||
99 | } | ||
100 | except ImportError: | ||
101 | sys.stderr.write("The Sphinx sphinx_rtd_theme HTML theme was not found.\ | ||
102 | \nPlease make sure to install the sphinx_rtd_theme python package.\n") | ||
103 | sys.exit(1) | ||
98 | 104 | ||
99 | html_logo = 'sphinx-static/YoctoProject_Logo_RGB.jpg' | 105 | html_logo = 'sphinx-static/YoctoProject_Logo_RGB.jpg' |
100 | 106 | ||
diff --git a/documentation/sphinx/yocto-vars.py b/documentation/sphinx/yocto-vars.py index 5689472991..8083d7da19 100644 --- a/documentation/sphinx/yocto-vars.py +++ b/documentation/sphinx/yocto-vars.py | |||
@@ -1,10 +1,19 @@ | |||
1 | #!/usr/bin/env python | 1 | #!/usr/bin/env python |
2 | import re | 2 | import re |
3 | import yaml | 3 | import sys |
4 | 4 | ||
5 | import sphinx | 5 | import sphinx |
6 | from sphinx.application import Sphinx | 6 | from sphinx.application import Sphinx |
7 | 7 | ||
8 | # This extension uses pyyaml, report an explicit | ||
9 | # error message if it's not installed | ||
10 | try: | ||
11 | import yaml | ||
12 | except ImportError: | ||
13 | sys.stderr.write("The Yocto Project Sphinx documentation requires PyYAML.\ | ||
14 | \nPlease make sure to install pyyaml python package.\n") | ||
15 | sys.exit(1) | ||
16 | |||
8 | __version__ = '1.0' | 17 | __version__ = '1.0' |
9 | 18 | ||
10 | # Variables substitutions. Uses {VAR} subst using variables defined in poky.yaml | 19 | # Variables substitutions. Uses {VAR} subst using variables defined in poky.yaml |