summaryrefslogtreecommitdiff
path: root/sphinx/application.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2021-05-16 23:48:42 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2021-05-16 23:48:42 +0900
commite5f6c7726351296f8da27cd7bb2f84fe8e7cea8d (patch)
treeb64c816d463da5e59be4cd2146f9939d2f66d78e /sphinx/application.py
parent8d87dde43ba0400c46d791e42d9b50bc879cdddb (diff)
downloadsphinx-git-e5f6c7726351296f8da27cd7bb2f84fe8e7cea8d.tar.gz
refactor: Do config file existence check in Config.read()
Diffstat (limited to 'sphinx/application.py')
-rw-r--r--sphinx/application.py17
1 files changed, 5 insertions, 12 deletions
diff --git a/sphinx/application.py b/sphinx/application.py
index 588a808f1..07049ffcd 100644
--- a/sphinx/application.py
+++ b/sphinx/application.py
@@ -152,12 +152,6 @@ class Sphinx:
self.srcdir = abspath(srcdir)
self.outdir = abspath(outdir)
self.doctreedir = abspath(doctreedir)
- self.confdir = confdir
- if self.confdir: # confdir is optional
- self.confdir = abspath(self.confdir)
- if not path.isfile(path.join(self.confdir, 'conf.py')):
- raise ApplicationError(__("config directory doesn't contain a "
- "conf.py file (%s)") % confdir)
if not path.isdir(self.srcdir):
raise ApplicationError(__('Cannot find source directory (%s)') %
@@ -212,9 +206,13 @@ class Sphinx:
# read config
self.tags = Tags(tags)
- if self.confdir is None:
+ if confdir is None:
+ # set confdir to srcdir if -C given (!= no confdir); a few pieces
+ # of code expect a confdir to be set
+ self.confdir = self.srcdir
self.config = Config({}, confoverrides or {})
else:
+ self.confdir = abspath(confdir)
self.config = Config.read(self.confdir, confoverrides or {}, self.tags)
# initialize some limited config variables before initialize i18n and loading
@@ -230,11 +228,6 @@ class Sphinx:
__('This project needs at least Sphinx v%s and therefore cannot '
'be built with this version.') % self.config.needs_sphinx)
- # set confdir to srcdir if -C given (!= no confdir); a few pieces
- # of code expect a confdir to be set
- if self.confdir is None:
- self.confdir = self.srcdir
-
# load all built-in extension modules
for extension in builtin_extensions:
self.setup_extension(extension)