From a69d74c842a0f55ffa1408fa058138ac9637a0c6 Mon Sep 17 00:00:00 2001 From: Nicolas Dechesne Date: Fri, 18 Sep 2020 10:14:14 +0200 Subject: 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 Signed-off-by: Richard Purdie --- documentation/sphinx/yocto-vars.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'documentation/sphinx/yocto-vars.py') 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 @@ #!/usr/bin/env python import re -import yaml +import sys import sphinx from sphinx.application import Sphinx +# This extension uses pyyaml, report an explicit +# error message if it's not installed +try: + import yaml +except ImportError: + sys.stderr.write("The Yocto Project Sphinx documentation requires PyYAML.\ + \nPlease make sure to install pyyaml python package.\n") + sys.exit(1) + __version__ = '1.0' # Variables substitutions. Uses {VAR} subst using variables defined in poky.yaml -- cgit v1.2.3-54-g00ecf