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,6 +133,15 @@ 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)
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) pytex.feed(working_dir / template, {"infos": infos}, output=dest, force=1)
logger.debug(f"{dest} fed") logger.debug(f"{dest} fed")
@ -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()