diff options
author | Takeshi KOMIYA <i.tkomiya@gmail.com> | 2019-04-14 02:17:56 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-14 02:17:56 +0900 |
commit | 11a4e47d6295b40ca02f3d2dd0e6e021568c150f (patch) | |
tree | febc317967726b0e218cb772c142687b444648ba | |
parent | 91fac1a0c3d25f0ca1c35eed266877000936b1a2 (diff) | |
parent | d45c0d33f235e549e10fdaae4a018082061a592d (diff) | |
download | sphinx-git-11a4e47d6295b40ca02f3d2dd0e6e021568c150f.tar.gz |
Merge pull request #6277 from tk0miya/6271_make_clean
Fix #6271: make clean is catastrophically broken if building into '.'
-rw-r--r-- | CHANGES | 1 | ||||
-rw-r--r-- | sphinx/cmd/make_mode.py | 8 |
2 files changed, 9 insertions, 0 deletions
@@ -70,6 +70,7 @@ Features added * #6232: Enable CLI override of Makefile variables * #6212 autosummary: Add :confval:`autosummary_imported_members` to display imported members on autosummary +* #6271: ``make clean`` is catastrophically broken if building into '.' Bugs fixed ---------- diff --git a/sphinx/cmd/make_mode.py b/sphinx/cmd/make_mode.py index 82a88933d..e87aa02fc 100644 --- a/sphinx/cmd/make_mode.py +++ b/sphinx/cmd/make_mode.py @@ -72,11 +72,19 @@ class Make: def build_clean(self): # type: () -> int + srcdir = path.abspath(self.srcdir) + builddir = path.abspath(self.builddir) if not path.exists(self.builddir): return 0 elif not path.isdir(self.builddir): print("Error: %r is not a directory!" % self.builddir) return 1 + elif srcdir == builddir: + print("Error: %r is same as source directory!" % self.builddir) + return 1 + elif path.commonpath([srcdir, builddir]) == builddir: + print("Error: %r directory contains source directory!" % self.builddir) + return 1 print("Removing everything under %r..." % self.builddir) for item in os.listdir(self.builddir): rmtree(self.builddir_join(item)) |