Skip to content

Commit 6d79841

Browse files
committed
Bazel: add --no-cleanup to installer script
1 parent a8543d4 commit 6d79841

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

misc/bazel/internal/install.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@
2727
help="ripunzip executable rlocation")
2828
parser.add_argument("--zip-manifest", required=True,
2929
help="The rlocation of a file containing newline-separated `prefix:zip_file` entries")
30+
parser.add_argument("--cleanup", action=argparse.BooleanOptionalAction, default=True,
31+
help="Whether to wipe the destination directory before installing (true by default)")
3032
opts = parser.parse_args()
3133

3234
build_file = runfiles.Rlocation(opts.build_file)
@@ -35,10 +37,10 @@
3537
zip_manifest = runfiles.Rlocation(opts.zip_manifest)
3638
destdir = pathlib.Path(build_file).resolve().parent / opts.destdir
3739

38-
if destdir.exists():
40+
if destdir.exists() and opts.cleanup:
3941
shutil.rmtree(destdir)
4042

41-
destdir.mkdir(parents=True)
43+
destdir.mkdir(parents=True, exist_ok=True)
4244
subprocess.run([script, "--destdir", destdir], check=True)
4345

4446
with open(zip_manifest) as manifest:

0 commit comments

Comments
 (0)