Skip to content

Commit cb12061

Browse files
larryliu0820facebook-github-bot
authored andcommitted
Add --clean option to install_requirements.py (#5348)
Summary: as titled. remove `cmake-out/` and `pip-out/` before installing ExecuTorch. Android is creating directory name such as `cmake-out-armv8` so removing those as well. Pull Request resolved: #5348 Test Plan: Tried on my machine ``` $ bash install_requirements.sh --clean Cleaning build artifacts... Cleaning pip-out/... Cleaning cmake-out-android-arm64-v8a/... Cleaning cmake-out-android-x86_64/... Done cleaning build artifacts. ``` Reviewed By: kimishpatel, dbort Differential Revision: D62648278 Pulled By: larryliu0820 fbshipit-source-id: 3699015fe4b960d8087556cb29388863df10285b
1 parent 3298b22 commit cb12061

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

install_requirements.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,11 @@
55
# LICENSE file in the root directory of this source tree.
66

77

8+
import glob
89
import os
910
import platform
1011
import re
12+
import shutil
1113
import subprocess
1214
import sys
1315

@@ -78,6 +80,16 @@ def python_is_compatible():
7880
else:
7981
print(f"Error: {arg} must follow --pybind")
8082
sys.exit(1)
83+
elif arg == "--clean":
84+
print("Cleaning build artifacts...")
85+
print("Cleaning pip-out/...")
86+
shutil.rmtree("pip-out/", ignore_errors=True)
87+
dirs = glob.glob("cmake-out*/")
88+
for d in dirs:
89+
print(f"Cleaning {d}...")
90+
shutil.rmtree(d, ignore_errors=True)
91+
print("Done cleaning build artifacts.")
92+
sys.exit(0)
8193
else:
8294
print(f"Error: Unknown option {arg}")
8395
sys.exit(1)

0 commit comments

Comments
 (0)