diff --git a/install_requirements.py b/install_requirements.py index 8f2daba0b1..8ce32d0a22 100644 --- a/install_requirements.py +++ b/install_requirements.py @@ -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 @@ -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)