Commit 1c01d293 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Remove intermediate files after completion

parent d47909c0
......@@ -9,7 +9,7 @@ all:
$(MAKE) -C preprocess
cp preprocess/output/order.txt .
./kazoo-merge-doc.py
rm -rf tmp new-templates
rm -rf tmp new-templates preprocess/output
clean:
rm -rf preprocess/output/*
......
......@@ -184,6 +184,9 @@ def run(options):
for each in orderlist:
filename=each.strip()
name=filename.replace("/", "_").replace("-", "_").split(".tmplt")[0]
middle_file = f"{result_folder}/{name}"
pre_file = f"{middle_file}.pre"
post_file = f"{middle_file}.post"
try:
process_one_file (tmplt=name,
old=old_folder+"/"+name,
......@@ -193,12 +196,17 @@ def run(options):
pass
else:
wiki_output.write(f"\n=== {filename} ===\n")
pre_content=open(result_folder+"/"+name+".pre", "r").readlines()
middle_content=open(result_folder+"/"+name, "r").readlines()
post_content=open(result_folder+"/"+name+".post", "r").readlines()
pre_content = open(pre_file, "r").readlines()
middle_content = open(middle_file, "r").readlines()
post_content = open(post_file, "r").readlines()
for lines in chain(pre_content, middle_content, post_content):
wiki_output.write(lines)
# Once the wiki file is generated, delete intermediate files
os.remove(pre_file)
os.remove(middle_file)
os.remove(post_file)
wiki_output.close()
def main():
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment