drivers base/cacheinfo: Convert to hotplug state machine
[linux/fpc-iii.git] / Documentation / sphinx / load_config.py
blob301a21aa4f631d8477445c4951da9e329189bad2
1 # -*- coding: utf-8; mode: python -*-
2 # pylint: disable=R0903, C0330, R0914, R0912, E0401
4 import os
5 import sys
6 from sphinx.util.pycompat import execfile_
8 # ------------------------------------------------------------------------------
9 def loadConfig(namespace):
10 # ------------------------------------------------------------------------------
12 u"""Load an additional configuration file into *namespace*.
14 The name of the configuration file is taken from the environment
15 ``SPHINX_CONF``. The external configuration file extends (or overwrites) the
16 configuration values from the origin ``conf.py``. With this you are able to
17 maintain *build themes*. """
19 config_file = os.environ.get("SPHINX_CONF", None)
20 if (config_file is not None
21 and os.path.normpath(namespace["__file__"]) != os.path.normpath(config_file) ):
22 config_file = os.path.abspath(config_file)
24 if os.path.isfile(config_file):
25 sys.stdout.write("load additional sphinx-config: %s\n" % config_file)
26 config = namespace.copy()
27 config['__file__'] = config_file
28 execfile_(config_file, config)
29 del config['__file__']
30 namespace.update(config)
31 else:
32 sys.stderr.write("WARNING: additional sphinx-config not found: %s\n" % config_file)