summaryrefslogtreecommitdiff
path: root/sphinx/config.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2022-01-12 02:34:52 +0900
committerGitHub <noreply@github.com>2022-01-12 02:34:52 +0900
commit99c144d8cd68fd3812342be192de6117d615550f (patch)
tree7c0682806309e514ec010357d702287edb111b24 /sphinx/config.py
parent2b784e23d8341b4e4ef551a8f8d23a1aad822805 (diff)
parent2a3ea2e490c2d34895e7d18c52943c01bd7ba30b (diff)
downloadsphinx-git-99c144d8cd68fd3812342be192de6117d615550f.tar.gz
Merge pull request #10079 from tk0miya/10061_confval_added_by_themes_not_initialized
Fix #10061: html theme: Confvals added by themes are not initialized
Diffstat (limited to 'sphinx/config.py')
-rw-r--r--sphinx/config.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/sphinx/config.py b/sphinx/config.py
index 9cce0cc41..37ca06e1d 100644
--- a/sphinx/config.py
+++ b/sphinx/config.py
@@ -251,6 +251,17 @@ class Config:
if name in self.values:
self.__dict__[name] = config[name]
+ def post_init_values(self) -> None:
+ """
+ Initialize additional config variables that are added after init_values() called.
+ """
+ config = self._raw_config
+ for name in config:
+ if name not in self.__dict__ and name in self.values:
+ self.__dict__[name] = config[name]
+
+ check_confval_types(None, self)
+
def __getattr__(self, name: str) -> Any:
if name.startswith('_'):
raise AttributeError(name)
@@ -427,7 +438,7 @@ def check_confval_types(app: "Sphinx", config: Config) -> None:
"but `{current}` is given.")
logger.warning(msg.format(name=confval.name,
current=confval.value,
- candidates=annotations.candidates))
+ candidates=annotations.candidates), once=True)
else:
if type(confval.value) is type(default):
continue
@@ -452,13 +463,13 @@ def check_confval_types(app: "Sphinx", config: Config) -> None:
permitted = " or ".join(wrapped_annotations)
logger.warning(msg.format(name=confval.name,
current=type(confval.value),
- permitted=permitted))
+ permitted=permitted), once=True)
else:
msg = __("The config value `{name}' has type `{current.__name__}', "
"defaults to `{default.__name__}'.")
logger.warning(msg.format(name=confval.name,
current=type(confval.value),
- default=type(default)))
+ default=type(default)), once=True)
def check_primary_domain(app: "Sphinx", config: Config) -> None: