-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 conf.py file, matching $(srctree)/Documentation/*/conf.py 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 SPHINX_CONF=conf_nitpick.py htmldocs With this, the Documentation/conf.py is read first and updated with the configuration values from the Documentation/media/conf_nitpick.py. Signed-off-by: Markus Heiser <markus.heiser@darmarIT.de> Signed-off-by: Jonathan Corbet <corbet@lwn.net>
- Loading branch information
Markus Heiser
authored and
Jonathan Corbet
committed
Aug 14, 2016
1 parent
3eb6cd6
commit 606b9ac
Showing
4 changed files
with
82 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 ``conf.py``. 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) |