This commit is contained in:
2026-01-21 23:15:32 -08:00
parent d1ec5807e2
commit d4f3cf90ec
2 changed files with 13 additions and 58 deletions

View File

@@ -391,6 +391,9 @@ def _install_deno(version: str | None = None) -> int:
def main() -> int:
# Ensure interactive stdin if piped
_ensure_interactive_stdin()
parser = argparse.ArgumentParser(
description="Bootstrap Medios-Macina: install deps and Playwright browsers"
)
@@ -488,11 +491,6 @@ def main() -> int:
)
args = parser.parse_args()
# If stdout is a TTY but stdin is a pipe (e.g. curl | python),
# re-open stdin to the console so interactive prompts work.
if sys.stdout.isatty() and not args.quiet:
_ensure_interactive_stdin()
# Ensure repo_root is always the project root, not the current working directory
# This prevents issues when bootstrap.py is run from different directories
try:
@@ -924,30 +922,32 @@ def main() -> int:
print("✅ Installation check complete!")
return 0
# If no specific action flag is passed and we're in a terminal, show the menu
if (sys.stdin.isatty() or sys.stdout.isatty()) and not args.quiet:
# If no specific action flag is passed and we're in a terminal (or we're being piped), show the menu
if (sys.stdin.isatty() or sys.stdout.isatty() or script_path is None) and not args.quiet:
sel = _interactive_menu()
if sel == "install":
# If running via pipe/standalone or not in a repo, ask for installation path
if not is_in_repo or script_path is None:
if script_path is None or not is_in_repo:
if not shutil.which("git"):
print("\nError: 'git' was not found on your PATH.", file=sys.stderr)
print("Please install Git (https://git-scm.com/) and try again.", file=sys.stderr)
return 1
try:
# Force a prompt to choose the folder
if is_in_repo:
default_install = repo_root
else:
default_install = Path.cwd() / "Medios-Macina"
print(f"\nWhere would you like to install Medeos-Macina?")
print(f"\n[WEB INSTALLER MODE]")
print(f"Where would you like to install Medios-Macina?")
install_dir_raw = input(f"Installation directory [{default_install}]: ").strip()
if not install_dir_raw:
install_path = default_install
else:
install_path = Path(install_dir_raw).resolve()
except EOFError:
except (EOFError, KeyboardInterrupt):
return 1
if not install_path.exists():
@@ -960,7 +960,7 @@ def main() -> int:
print(f"Using existing repository in {install_path}.")
repo_root = install_path
else:
print(f"Cloning Medeos-Macina into {install_path} (depth 1)...")
print(f"Cloning Medios-Macina into {install_path} (depth 1)...")
print(f"Source: {REPO_URL}")
try:
subprocess.check_call(["git", "clone", "--depth", "1", REPO_URL, str(install_path)])
@@ -1008,7 +1008,7 @@ def main() -> int:
return 0
elif sel == 0:
return 0
elif not args.no_delegate:
elif not args.no_delegate and script_path is not None:
# Default non-interactive behavior: delegate to platform script
rc = run_platform_bootstrap(repo_root)
if rc != 0: