path: root/Documentation/sphinx/
diff options
authorMarkus Heiser <>2016-08-13 16:12:42 +0200
committerJonathan Corbet <>2016-08-14 11:51:51 -0600
commit606b9ac81a63ab3adb7e61206b9ae34ee186a89d (patch)
tree8ff0fcf5ec5d762a0ad7fc7e05fbbeb8d17f6801 /Documentation/sphinx/
parent3eb6cd6834c356f40e1633a0ced4ff9a4c59936b (diff)
doc-rst: generic way to build only sphinx sub-folders
Add a generic way to build only a reST sub-folder with or without a individual *build-theme*. * control *sub-folders* by environment SPHINXDIRS * control *build-theme* by environment SPHINX_CONF Folders with a file, matching $(srctree)/Documentation/*/ can be build and distributed *stand-alone*. E.g. to compile only the html of 'media' and 'gpu' folder use:: make SPHINXDIRS="media gpu" htmldocs To use an additional sphinx-build configuration (*build-theme*) set the name of the configuration file to SPHINX_CONF. E.g. to compile only the html of 'media' with the *nit-picking* build use:: make SPHINXDIRS=media htmldocs With this, the Documentation/ is read first and updated with the configuration values from the Documentation/media/ Signed-off-by: Markus Heiser <> Signed-off-by: Jonathan Corbet <>
Diffstat (limited to 'Documentation/sphinx/')
1 files changed, 32 insertions, 0 deletions
diff --git a/Documentation/sphinx/ b/Documentation/sphinx/
new file mode 100644
index 000000000000..301a21aa4f63
--- /dev/null
+++ b/Documentation/sphinx/
@@ -0,0 +1,32 @@
+# -*- coding: utf-8; mode: python -*-
+# pylint: disable=R0903, C0330, R0914, R0912, E0401
+import os
+import sys
+from sphinx.util.pycompat import execfile_
+# ------------------------------------------------------------------------------
+def loadConfig(namespace):
+# ------------------------------------------------------------------------------
+ u"""Load an additional configuration file into *namespace*.
+ The name of the configuration file is taken from the environment
+ ``SPHINX_CONF``. The external configuration file extends (or overwrites) the
+ configuration values from the origin ````. With this you are able to
+ maintain *build themes*. """
+ config_file = os.environ.get("SPHINX_CONF", None)
+ if (config_file is not None
+ and os.path.normpath(namespace["__file__"]) != os.path.normpath(config_file) ):
+ config_file = os.path.abspath(config_file)
+ if os.path.isfile(config_file):
+ sys.stdout.write("load additional sphinx-config: %s\n" % config_file)
+ config = namespace.copy()
+ config['__file__'] = config_file
+ execfile_(config_file, config)
+ del config['__file__']
+ namespace.update(config)
+ else:
+ sys.stderr.write("WARNING: additional sphinx-config not found: %s\n" % config_file)