diff --git a/install/common/build-image.py b/install/common/build-image.py index 3e2ab71..6d99877 100644 --- a/install/common/build-image.py +++ b/install/common/build-image.py @@ -18,6 +18,17 @@ elif platform.system() == "Linux": ARCH = platform.machine() +def str2bool(v): + if isinstance(v, bool): + return v + if v.lower() in ("yes", "true", "t", "y", "1"): + return True + elif v.lower() in ("no", "false", "f", "n", "0"): + return False + else: + raise argparse.ArgumentTypeError("Boolean value expected.") + + def main(): parser = argparse.ArgumentParser() parser.add_argument( @@ -40,7 +51,10 @@ def main(): ) parser.add_argument( "--use-cache", - action="store_true", + type=str2bool, + nargs="?", + default=False, + const=True, help="Use the builder's cache to speed up the builds (not suitable for release builds)", ) args = parser.parse_args()