Feat: crazy mod! Try until it works!

This commit is contained in:
Bertrand Benjamin 2019-12-22 07:18:41 +01:00
parent 21d650101c
commit 39785cb617

View File

@ -133,7 +133,16 @@ def produce_and_compile(options):
dest = working_dir / Path(template.replace("tpl", infos["num"])) dest = working_dir / Path(template.replace("tpl", infos["num"]))
logger.debug(f"Feeding template toward {dest}") logger.debug(f"Feeding template toward {dest}")
tex_files.append(dest) tex_files.append(dest)
pytex.feed(working_dir / template, {"infos": infos}, output=dest, force=1) if options.crazy:
while True:
try:
pytex.feed(working_dir / template, {"infos": infos}, output=dest, force=1)
except:
pass
else:
break
else:
pytex.feed(working_dir / template, {"infos": infos}, output=dest, force=1)
logger.debug(f"{dest} fed") logger.debug(f"{dest} fed")
if not options.no_compil: if not options.no_compil:
@ -248,6 +257,13 @@ def main():
dest="corr", dest="corr",
help="Create and compile correction while making subjects", help="Create and compile correction while making subjects",
) )
parser.add_option(
"-C",
"--crazy",
action="store_true",
dest="crazy",
help="Crazy mode. Tries and tries again until template feeding success!",
)
(options, _) = parser.parse_args() (options, _) = parser.parse_args()