mirror of https://github.com/tLDP/python-tldp
fix publish function so it propagates return code
This commit is contained in:
parent
74544227b8
commit
9c3ed36bc2
|
@ -324,18 +324,19 @@ def build(config, docs, **kwargs):
|
||||||
def publish(config, docs, **kwargs):
|
def publish(config, docs, **kwargs):
|
||||||
config.build = True
|
config.build = True
|
||||||
result = build(config, docs, **kwargs)
|
result = build(config, docs, **kwargs)
|
||||||
if result == os.EX_OK:
|
if result != os.EX_OK:
|
||||||
for x, source in enumerate(docs, 1):
|
return result
|
||||||
logger.info("Publishing (%d of %d) to %s.",
|
for x, source in enumerate(docs, 1):
|
||||||
x, len(docs), source.output.dirname)
|
logger.info("Publishing (%d of %d) to %s.",
|
||||||
# -- swapdirs must raise an error if there are problems
|
x, len(docs), source.output.dirname)
|
||||||
#
|
# -- swapdirs must raise an error if there are problems
|
||||||
swapdirs(source.working.dirname, source.output.dirname)
|
#
|
||||||
if os.path.isdir(source.working.dirname):
|
swapdirs(source.working.dirname, source.output.dirname)
|
||||||
logger.debug("%s removing old directory %s",
|
if os.path.isdir(source.working.dirname):
|
||||||
source.stem, source.working.dirname)
|
logger.debug("%s removing old directory %s",
|
||||||
shutil.rmtree(source.working.dirname)
|
source.stem, source.working.dirname)
|
||||||
post_publish_cleanup(docs)
|
shutil.rmtree(source.working.dirname)
|
||||||
|
post_publish_cleanup(docs)
|
||||||
return os.EX_OK
|
return os.EX_OK
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue