Allow passing true/false to --use-cache build arg

This commit is contained in:
Alex Pyrgiotis 2024-12-04 13:30:56 +02:00
parent 3eac00b873
commit 4bd794dbd1
No known key found for this signature in database
GPG key ID: B6C15EBA0357C9AA

View file

@ -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()