Skip to content
Snippets Groups Projects
Commit c047361d authored by Filippo Cremonese's avatar Filippo Cremonese
Browse files

Start to implement --pretend option

parent f3dc5ec6
No related branches found
No related tags found
No related merge requests found
......@@ -8,6 +8,7 @@ from orchestra.model.configuration import Configuration
parser = argparse.ArgumentParser()
# TODO: set default loglevel to INFO or WARNING
parser.add_argument("--loglevel", "-v", default="DEBUG", choices=["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"])
parser.add_argument("--pretend", "-n", action="store_true", help="Do not execute actions, only print what would be done")
parser.add_argument("--quiet", "-q", action="store_true", help="Do not show output of executed commands")
parser.add_argument("--no-config-cache", action="store_true", help="Do not cache generated yaml configuration")
parser.add_argument("--from-source", "-B", action="store_true", help="Build all components from source")
......
......@@ -20,8 +20,13 @@ def handle_clean(args, config: Configuration):
exit(1)
build_dir = build.install.environment["BUILD_DIR"]
shutil.rmtree(build_dir, ignore_errors=True)
logger.info(f"Cleaning build dir for {build.qualified_name} ({build_dir})")
if not args.pretend:
shutil.rmtree(build_dir, ignore_errors=True)
if args.include_sources:
sources_dir = build.install.environment["SOURCE_DIR"]
shutil.rmtree(sources_dir, ignore_errors=True)
logger.info(f"Cleaning source dir for {build.qualified_name} ({sources_dir})")
if not args.pretend:
shutil.rmtree(sources_dir, ignore_errors=True)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment