mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix #6271: make clean is catastrophically broken if building into '.'
This commit is contained in:
parent
817cb6e96b
commit
d45c0d33f2
1
CHANGES
1
CHANGES
@ -68,6 +68,7 @@ Features added
|
|||||||
* #6232: Enable CLI override of Makefile variables
|
* #6232: Enable CLI override of Makefile variables
|
||||||
* #6212 autosummary: Add :confval:`autosummary_imported_members` to display
|
* #6212 autosummary: Add :confval:`autosummary_imported_members` to display
|
||||||
imported members on autosummary
|
imported members on autosummary
|
||||||
|
* #6271: ``make clean`` is catastrophically broken if building into '.'
|
||||||
|
|
||||||
Bugs fixed
|
Bugs fixed
|
||||||
----------
|
----------
|
||||||
|
@ -72,11 +72,19 @@ class Make:
|
|||||||
|
|
||||||
def build_clean(self):
|
def build_clean(self):
|
||||||
# type: () -> int
|
# type: () -> int
|
||||||
|
srcdir = path.abspath(self.srcdir)
|
||||||
|
builddir = path.abspath(self.builddir)
|
||||||
if not path.exists(self.builddir):
|
if not path.exists(self.builddir):
|
||||||
return 0
|
return 0
|
||||||
elif not path.isdir(self.builddir):
|
elif not path.isdir(self.builddir):
|
||||||
print("Error: %r is not a directory!" % self.builddir)
|
print("Error: %r is not a directory!" % self.builddir)
|
||||||
return 1
|
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)
|
print("Removing everything under %r..." % self.builddir)
|
||||||
for item in os.listdir(self.builddir):
|
for item in os.listdir(self.builddir):
|
||||||
rmtree(self.builddir_join(item))
|
rmtree(self.builddir_join(item))
|
||||||
|
Loading…
Reference in New Issue
Block a user