Fix #7345: sphinx-build: Sphinx crashes if output directory exists as a file

This commit is contained in:
Takeshi KOMIYA 2020-03-21 14:47:02 +09:00
parent 593dcaf40c
commit 86c32fe0f1
2 changed files with 5 additions and 0 deletions

View File

@ -132,6 +132,7 @@ Bugs fixed
* #7289: console: use bright colors instead of bold
* #1539: C, parse array types.
* #2377: C, parse function pointers even in complex types.
* #7345: sphinx-build: Sphinx crashes if output directory exists as a file
Testing
--------

View File

@ -163,6 +163,10 @@ class Sphinx:
raise ApplicationError(__('Cannot find source directory (%s)') %
self.srcdir)
if path.exists(self.outdir) and not path.isdir(self.outdir):
raise ApplicationError(__('Output directory (%s) is not a directory') %
self.srcdir)
if self.srcdir == self.outdir:
raise ApplicationError(__('Source directory and destination '
'directory cannot be identical'))