diff --git a/scripts/bootstrap.py b/scripts/bootstrap.py index fb335b5..c6c648f 100644 --- a/scripts/bootstrap.py +++ b/scripts/bootstrap.py @@ -599,29 +599,36 @@ def main() -> int: installed = _is_installed() while True: print("\nMedeia-Macina bootstrap - interactive menu") + print("1) Install / Reinstall") + print("2) Extras") if installed: - print("1) Install / Reinstall") - print("2) Uninstall") - print("3) Status") - print("q) Quit") - choice = input("Choose an option: ").strip().lower() - if not choice or choice in ("1", "install", "reinstall"): - return "install" - if choice in ("2", "uninstall"): - return "uninstall" - if choice in ("3", "status"): - print("Installation detected." if installed else "Not installed.") - continue - if choice in ("q", "quit", "exit"): - return 0 - else: - print("1) Install") - print("q) Quit") - choice = input("Choose an option: ").strip().lower() - if not choice or choice in ("1", "install"): - return "install" - if choice in ("q", "quit", "exit"): - return 0 + print("3) Uninstall") + print("4) Status") + print("q) Quit") + + choice = input("Choose an option: ").strip().lower() + + if choice in ("1", "install", "reinstall"): + return "install" + + if choice in ("2", "extras"): + print("\nExtras Menu:") + print(" 1) HydrusNetwork (Setup & Clone)") + print(" b) Back") + extra_choice = input("Choose an extra: ").strip().lower() + if extra_choice == "1": + return "extras_hydrus" + continue # back to main menu + + if installed and choice in ("3", "uninstall"): + return "uninstall" + + if installed and choice in ("4", "status"): + print("Installation detected." if installed else "Not installed.") + continue + + if choice in ("q", "quit", "exit"): + return 0 except EOFError: # Non-interactive, fall back to delegating to platform helper return "delegate" @@ -780,6 +787,19 @@ def main() -> int: args.skip_deps = False args.install_editable = True args.no_playwright = False + elif sel == "extras_hydrus": + # Special case: run the hydrusnetwork.py script and then exit + hydrus_script = repo_root / "scripts" / "hydrusnetwork.py" + if hydrus_script.exists(): + try: + subprocess.check_call([sys.executable, str(hydrus_script)]) + except subprocess.CalledProcessError: + print("\nHydrusNetwork setup exited with an error.") + except Exception as e: + print(f"\nFailed to run HydrusNetwork setup: {e}") + else: + print(f"\nError: {hydrus_script} not found.") + return 0 elif sel == "uninstall": return _do_uninstall() elif sel == "delegate": diff --git a/scripts/hydrusnetwork.py b/scripts/hydrusnetwork.py index 7776645..bf1b01c 100644 --- a/scripts/hydrusnetwork.py +++ b/scripts/hydrusnetwork.py @@ -806,6 +806,29 @@ def main(argv: Optional[list[str]] = None) -> int: if args.verbose: logging.getLogger().setLevel(logging.DEBUG) + # Interactive setup for root and name if not provided and in a TTY + # We check sys.argv directly to see if the flags were explicitly passed. + if sys.stdin.isatty() and not any(arg in sys.argv for arg in ["--root", "-r", "--dest-name", "-d"]): + print("\nHydrusNetwork Setup") + print("--------------------") + + # Ask for root path + default_root = Path.home() + try: + root_input = input(f"Enter root directory for Hydrus installation [default: {default_root}]: ").strip() + if root_input: + args.root = root_input + else: + args.root = str(default_root) + + # Ask for destination folder name + dest_input = input(f"Enter folder name for Hydrus [default: hydrusnetwork]: ").strip() + if dest_input: + args.dest_name = dest_input + except (EOFError, KeyboardInterrupt): + print("\nSetup cancelled.") + return 0 + root = Path(args.root).expanduser().resolve() # Python executable inside the repo venv (set when we create/find the venv) venv_py = None