mirror of https://github.com/tLDP/python-tldp
and remove the build directory, if empty
This commit is contained in:
parent
c3e2237539
commit
c947cfaf57
|
@ -228,13 +228,12 @@ def create_dtworkingdir(config, docs):
|
||||||
return True, None
|
return True, None
|
||||||
|
|
||||||
|
|
||||||
def post_publish_cleanup(docs):
|
def post_publish_cleanup(workingdirs):
|
||||||
'''clean up any doctype directories left in --builddir'''
|
'''clean up empty directories left under --builddir'''
|
||||||
dtworkingdirs = set([x.dtworkingdir for x in docs])
|
for d in workingdirs:
|
||||||
for d in dtworkingdirs:
|
|
||||||
if os.path.isdir(d):
|
if os.path.isdir(d):
|
||||||
try:
|
try:
|
||||||
logger.debug("removing doctype build dir %s", d)
|
logger.debug("removing build dir %s", d)
|
||||||
os.rmdir(d)
|
os.rmdir(d)
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
if e.errno != errno.ENOTEMPTY:
|
if e.errno != errno.ENOTEMPTY:
|
||||||
|
@ -338,7 +337,9 @@ def publish(config, docs, **kwargs):
|
||||||
logger.debug("%s removing old directory %s",
|
logger.debug("%s removing old directory %s",
|
||||||
source.stem, source.working.dirname)
|
source.stem, source.working.dirname)
|
||||||
shutil.rmtree(source.working.dirname)
|
shutil.rmtree(source.working.dirname)
|
||||||
post_publish_cleanup(docs)
|
workingdirs = list(set([x.dtworkingdir for x in docs]))
|
||||||
|
workingdirs.append(config.builddir)
|
||||||
|
post_publish_cleanup(workingdirs)
|
||||||
return os.EX_OK
|
return os.EX_OK
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue