[wmlunits] For any WML errors encountered in addons...

...it kept the parser results in /tmp, wasting space.
This commit is contained in:
Elias Pschernig 2011-06-05 11:06:49 +00:00
parent 5e5ebdad23
commit 4f42ca826c

View file

@ -7,6 +7,14 @@ wesnoth executable must be available at runtime.
"""
import os, glob, sys, re, subprocess, optparse, tempfile, shutil
import atexit
tempdirs_to_clean = []
@atexit.register
def cleaner():
for temp_dir in tempdirs_to_clean:
shutil.rmtree(temp_dir, ignore_errors = True)
class WMLError(Exception):
"""
@ -220,6 +228,8 @@ class Parser:
output = self.keep_temp_dir
else:
output = tempfile.mkdtemp(prefix="wmlparser_")
tempdirs_to_clean.append(output)
self.temp_dir = output
p_option = "-p=" + defines if defines else "-p "
commandline = [self.wesnoth_exe]