build-deps.py: add -y to skip initial confirmation prompt

This commit is contained in:
Andrej730
2026-09-14 14:48:51 +05:00
parent 73d24a50d0
commit a0e0516795
3 changed files with 17 additions and 19 deletions
+1 -6
View File
@@ -217,12 +217,7 @@ def build() -> None:
for python_version in PYTHON_VERSIONS: for python_version in PYTHON_VERSIONS:
os.environ["PYTHON_VERSION"] = python_version os.environ["PYTHON_VERSION"] = python_version
print(f"Building for Python {python_version}...") print(f"Building for Python {python_version}...")
subprocess.run( run([sys.executable, str(REPO_WIN / "build-deps.py"), build_generator(), "Release", "-y"])
[sys.executable, str(REPO_WIN / "build-deps.py"), build_generator(), "Release"],
check=True,
text=True,
input="y\n",
)
OLD_ADD_COMMIT_SHA = set_env("ADD_COMMIT_SHA", "ON") OLD_ADD_COMMIT_SHA = set_env("ADD_COMMIT_SHA", "ON")
run( run(
[ [
+1 -6
View File
@@ -22,7 +22,6 @@
############################################################################### ###############################################################################
# #
import argparse import argparse
import subprocess
import sys import sys
from typing import NamedTuple, NoReturn from typing import NamedTuple, NoReturn
@@ -33,7 +32,6 @@ from common import (
BuildCfg, BuildCfg,
HelpStrings, HelpStrings,
ensure_script_dir, ensure_script_dir,
logger,
run_streamed, run_streamed,
) )
@@ -110,10 +108,7 @@ def main() -> None:
generator_args = [ARGS.generator] if ARGS.generator else [] 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 |". run_streamed(sys.executable, str(SCRIPT_DIR / "build-deps.py"), *generator_args, ARGS.build_cfg, "-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 / "run-cmake.py"), *generator_args, "--", *ARGS.extra_args) 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) run_streamed(sys.executable, str(SCRIPT_DIR / "build-ifcopenshell.py"), *generator_args, ARGS.build_cfg)
+15 -7
View File
@@ -80,6 +80,7 @@ class Args(NamedTuple):
num_build_procs: int num_build_procs: int
install_python: bool install_python: bool
install_qt6: bool install_qt6: bool
yes: bool
def print_build_config( def print_build_config(
@@ -229,6 +230,12 @@ def parse_args() -> Args:
"(default: True)" "(default: True)"
), ),
) )
parser.add_argument(
"-y",
"--yes",
action="store_true",
help="Skip the confirmation prompt before proceeding with the build.",
)
args = parser.parse_args() args = parser.parse_args()
logger.setLevel(args.log_level) logger.setLevel(args.log_level)
@@ -257,6 +264,7 @@ def parse_args() -> Args:
num_build_procs=num_build_procs, num_build_procs=num_build_procs,
install_python=install_python, install_python=install_python,
install_qt6=install_qt6, 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.warning("Warning: You will need roughly 8 GB of disk space to proceed.\n")
logger.info( if not ARGS.yes:
"If you are not ready with the above: type 'n' in the prompt below. Build proceeds on all other inputs!" 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("> ") do_continue = input("> ")
if do_continue == "n": if do_continue == "n":
sys.exit(0) sys.exit(0)
START_TIME = datetime.now().replace(microsecond=0) START_TIME = datetime.now().replace(microsecond=0)
logger.info(f"Build started at {START_TIME}.") logger.info(f"Build started at {START_TIME}.")