Skip to content

Commit

Permalink
[BE] Add --clean option to install_requirements.py (#6137)
Browse files Browse the repository at this point in the history
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
(cherry picked from commit cb12061)

Co-authored-by: Mengwei Liu <[email protected]>
  • Loading branch information
pytorchbot and larryliu0820 authored Oct 11, 2024
1 parent eca44f0 commit ab1e671
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions install_requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
# LICENSE file in the root directory of this source tree.


import glob
import os
import platform
import re
import shutil
import subprocess
import sys

Expand Down Expand Up @@ -78,6 +80,16 @@ def python_is_compatible():
else:
print(f"Error: {arg} must follow --pybind")
sys.exit(1)
elif arg == "--clean":
print("Cleaning build artifacts...")
print("Cleaning pip-out/...")
shutil.rmtree("pip-out/", ignore_errors=True)
dirs = glob.glob("cmake-out*/")
for d in dirs:
print(f"Cleaning {d}...")
shutil.rmtree(d, ignore_errors=True)
print("Done cleaning build artifacts.")
sys.exit(0)
else:
print(f"Error: Unknown option {arg}")
sys.exit(1)
Expand Down

0 comments on commit ab1e671

Please sign in to comment.