forked from platformio/platformio-core
Remove temporary INO/CPP file at process exit
This commit is contained in:
@ -86,7 +86,7 @@ class InoToCPPConverter(object):
|
|||||||
'$CXX -o "{0}" -x c++ -fpreprocessed -dD -E "{1}"'.format(
|
'$CXX -o "{0}" -x c++ -fpreprocessed -dD -E "{1}"'.format(
|
||||||
out_file, tmp_path), "Converting " + basename(
|
out_file, tmp_path), "Converting " + basename(
|
||||||
out_file[:-4])))
|
out_file[:-4])))
|
||||||
remove(tmp_path)
|
atexit.register(_delete_file, tmp_path)
|
||||||
return isfile(out_file)
|
return isfile(out_file)
|
||||||
|
|
||||||
def _parse_prototypes(self, contents):
|
def _parse_prototypes(self, contents):
|
||||||
@ -134,6 +134,13 @@ class InoToCPPConverter(object):
|
|||||||
|
|
||||||
|
|
||||||
def ConvertInoToCpp(env):
|
def ConvertInoToCpp(env):
|
||||||
|
ino_nodes = (env.Glob(join("$PROJECTSRC_DIR", "*.ino")) +
|
||||||
|
env.Glob(join("$PROJECTSRC_DIR", "*.pde")))
|
||||||
|
c = InoToCPPConverter(env)
|
||||||
|
out_file = c.convert(ino_nodes)
|
||||||
|
|
||||||
|
atexit.register(_delete_file, out_file)
|
||||||
|
|
||||||
|
|
||||||
def _delete_file(path):
|
def _delete_file(path):
|
||||||
try:
|
try:
|
||||||
@ -141,17 +148,9 @@ def ConvertInoToCpp(env):
|
|||||||
remove(path)
|
remove(path)
|
||||||
except: # pylint: disable=bare-except
|
except: # pylint: disable=bare-except
|
||||||
if path and isfile(path):
|
if path and isfile(path):
|
||||||
sys.stderr.write(
|
sys.stderr.write("Warning: Could not remove temporary file '%s'. "
|
||||||
"Warning: Could not remove temporary file '%s'. "
|
|
||||||
"Please remove it manually.\n" % path)
|
"Please remove it manually.\n" % path)
|
||||||
|
|
||||||
ino_nodes = (env.Glob(join("$PROJECTSRC_DIR", "*.ino")) +
|
|
||||||
env.Glob(join("$PROJECTSRC_DIR", "*.pde")))
|
|
||||||
c = InoToCPPConverter(env)
|
|
||||||
out_file = c.convert(ino_nodes)
|
|
||||||
|
|
||||||
atexit.register(_delete_file, out_file)
|
|
||||||
|
|
||||||
|
|
||||||
def DumpIDEData(env):
|
def DumpIDEData(env):
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user