summaryrefslogtreecommitdiff
path: root/sphinx/application.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2017-03-22 10:21:54 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2017-03-22 10:21:54 +0900
commit61df39f5354f30b98aceb665d5a1c6dbde93019f (patch)
tree78519e06b81e61f0ea1600796adfab22fce0a63a /sphinx/application.py
parent0f47b1d09d4d39a0ac0fe9feb16d1865a84bea75 (diff)
downloadsphinx-git-61df39f5354f30b98aceb665d5a1c6dbde93019f.tar.gz
Revert "Drop unused codes"
This reverts commit 0f47b1d09d4d39a0ac0fe9feb16d1865a84bea75.
Diffstat (limited to 'sphinx/application.py')
-rw-r--r--sphinx/application.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/sphinx/application.py b/sphinx/application.py
index f325935ad..eeaa954eb 100644
--- a/sphinx/application.py
+++ b/sphinx/application.py
@@ -207,11 +207,15 @@ class Sphinx(object):
# the config file itself can be an extension
if self.config.setup:
self._setting_up_extension = ['conf.py']
- raise ConfigError(
- _("'setup' that is specified in the conf.py has not been "
- "callable. Please provide a callable `setup` function "
- "in order to behave as a sphinx extension conf.py itself.")
- )
+ # py31 doesn't have 'callable' function for below check
+ if hasattr(self.config.setup, '__call__'):
+ self.config.setup(self)
+ else:
+ raise ConfigError(
+ _("'setup' that is specified in the conf.py has not been "
+ "callable. Please provide a callable `setup` function "
+ "in order to behave as a sphinx extension conf.py itself.")
+ )
# now that we know all config values, collect them from conf.py
self.config.init_values()