From a0e0516795207c88f0a2f92f9e906e64332d7f8b Mon Sep 17 00:00:00 2001 From: Andrej730 Date: Mon, 14 Sep 2026 14:48:51 +0500 Subject: [PATCH] build-deps.py: add `-y` to skip initial confirmation prompt --- win/build-all-win.py | 7 +------ win/build-all.py | 7 +------ win/build-deps.py | 22 +++++++++++++++------- 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/win/build-all-win.py b/win/build-all-win.py index ce031b935f..f868510861 100644 --- a/win/build-all-win.py +++ b/win/build-all-win.py @@ -217,12 +217,7 @@ def build() -> None: for python_version in PYTHON_VERSIONS: os.environ["PYTHON_VERSION"] = python_version print(f"Building for Python {python_version}...") - subprocess.run( - [sys.executable, str(REPO_WIN / "build-deps.py"), build_generator(), "Release"], - check=True, - text=True, - input="y\n", - ) + run([sys.executable, str(REPO_WIN / "build-deps.py"), build_generator(), "Release", "-y"]) OLD_ADD_COMMIT_SHA = set_env("ADD_COMMIT_SHA", "ON") run( [ diff --git a/win/build-all.py b/win/build-all.py index e80cd9abea..5e9b245068 100644 --- a/win/build-all.py +++ b/win/build-all.py @@ -22,7 +22,6 @@ ############################################################################### # import argparse -import subprocess import sys from typing import NamedTuple, NoReturn @@ -33,7 +32,6 @@ from common import ( BuildCfg, HelpStrings, ensure_script_dir, - logger, run_streamed, ) @@ -110,10 +108,7 @@ def main() -> None: generator_args = [ARGS.generator] if ARGS.generator else [] - # Auto-answer build-deps.py's "are you ready" prompt, same trick as build-all.cmd's "echo y |". - build_deps_cmd = [sys.executable, str(SCRIPT_DIR / "build-deps.py"), *generator_args, ARGS.build_cfg] - logger.info(f"$ {' '.join(build_deps_cmd)}") - subprocess.run(build_deps_cmd, input="y\n", text=True, check=True) + run_streamed(sys.executable, str(SCRIPT_DIR / "build-deps.py"), *generator_args, ARGS.build_cfg, "-y") run_streamed(sys.executable, str(SCRIPT_DIR / "run-cmake.py"), *generator_args, "--", *ARGS.extra_args) run_streamed(sys.executable, str(SCRIPT_DIR / "build-ifcopenshell.py"), *generator_args, ARGS.build_cfg) diff --git a/win/build-deps.py b/win/build-deps.py index 6ba217afd6..740ecf2908 100644 --- a/win/build-deps.py +++ b/win/build-deps.py @@ -80,6 +80,7 @@ class Args(NamedTuple): num_build_procs: int install_python: bool install_qt6: bool + yes: bool def print_build_config( @@ -229,6 +230,12 @@ def parse_args() -> Args: "(default: True)" ), ) + parser.add_argument( + "-y", + "--yes", + action="store_true", + help="Skip the confirmation prompt before proceeding with the build.", + ) args = parser.parse_args() logger.setLevel(args.log_level) @@ -257,6 +264,7 @@ def parse_args() -> Args: num_build_procs=num_build_procs, install_python=install_python, install_qt6=install_qt6, + yes=args.yes, ) @@ -316,13 +324,13 @@ def main() -> None: ) logger.warning("Warning: You will need roughly 8 GB of disk space to proceed.\n") - logger.info( - "If you are not ready with the above: type 'n' in the prompt below. Build proceeds on all other inputs!" - ) - # TODO: add a `-y` option to skip this prompt. - do_continue = input("> ") - if do_continue == "n": - sys.exit(0) + if not ARGS.yes: + logger.info( + "If you are not ready with the above: type 'n' in the prompt below. Build proceeds on all other inputs!" + ) + do_continue = input("> ") + if do_continue == "n": + sys.exit(0) START_TIME = datetime.now().replace(microsecond=0) logger.info(f"Build started at {START_TIME}.")