sys-script: remove output directory if it exists

meson will occasionally call us even though the output directory
exists. Let's just nuke and recreate in that case.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2017-09-29 12:28:25 +02:00
parent 227ef9bc38
commit 0bca795456
2 changed files with 6 additions and 0 deletions

View File

@@ -36,6 +36,7 @@ OUTFILE_MODE = 0o775
OUTFILE_FUNCS = r"""
import os, sys
import shutil
def d(path, mode):
os.mkdir(path, mode)
@@ -58,6 +59,8 @@ if not os.path.isdir(sys.argv[1]):
os.chdir(sys.argv[1])
if os.path.exists('sys'):
shutil.rmtree('sys')
"""