Skip to content

Commit 5ddb68e

Browse files
committed
Add XOBJECTS_KEEP_BUILD_FILES flag to keep sources and so from deletion
1 parent 72f12eb commit 5ddb68e

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

xobjects/context_cpu.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -466,14 +466,15 @@ def compile_kernel(
466466
return Path(output_file)
467467
finally:
468468
# Clean temp files
469-
files_to_remove = [
470-
module_name + ".c",
471-
module_name + ".o",
472-
]
473-
474-
for ff in files_to_remove:
475-
if os.path.exists(ff):
476-
os.remove(ff)
469+
if 'XOBJECTS_KEEP_BUILD_FILES' not in os.environ:
470+
files_to_remove = [
471+
module_name + ".c",
472+
module_name + ".o",
473+
]
474+
475+
for ff in files_to_remove:
476+
if os.path.exists(ff):
477+
os.remove(ff)
477478

478479
def _build_sources(
479480
self,

0 commit comments

Comments
 (0)