Skip to content

Commit 0bca795

Browse files
committed
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.
1 parent 227ef9b commit 0bca795

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

test/create-sys-script.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636

3737
OUTFILE_FUNCS = r"""
3838
import os, sys
39+
import shutil
3940
4041
def d(path, mode):
4142
os.mkdir(path, mode)
@@ -58,6 +59,8 @@ def f(path, mode, contents):
5859
5960
os.chdir(sys.argv[1])
6061
62+
if os.path.exists('sys'):
63+
shutil.rmtree('sys')
6164
"""
6265

6366

test/sys-script.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#
2121

2222
import os, sys
23+
import shutil
2324

2425
def d(path, mode):
2526
os.mkdir(path, mode)
@@ -40,6 +41,8 @@ def f(path, mode, contents):
4041

4142
os.chdir(sys.argv[1])
4243

44+
if os.path.exists('sys'):
45+
shutil.rmtree('sys')
4346
d('sys', 0o755)
4447
d('sys/kernel', 0o775)
4548
f('sys/kernel/kexec_crash_loaded', 0o664, b'0\n')

0 commit comments

Comments
 (0)