This commit is contained in:
2026-01-11 11:11:32 -08:00
parent 234f7aca5c
commit fa9f765089
2 changed files with 65 additions and 22 deletions

View File

@@ -599,29 +599,36 @@ def main() -> int:
installed = _is_installed() installed = _is_installed()
while True: while True:
print("\nMedeia-Macina bootstrap - interactive menu") print("\nMedeia-Macina bootstrap - interactive menu")
print("1) Install / Reinstall")
print("2) Extras")
if installed: if installed:
print("1) Install / Reinstall") print("3) Uninstall")
print("2) Uninstall") print("4) Status")
print("3) Status") print("q) Quit")
print("q) Quit")
choice = input("Choose an option: ").strip().lower() choice = input("Choose an option: ").strip().lower()
if not choice or choice in ("1", "install", "reinstall"):
return "install" if choice in ("1", "install", "reinstall"):
if choice in ("2", "uninstall"): return "install"
return "uninstall"
if choice in ("3", "status"): if choice in ("2", "extras"):
print("Installation detected." if installed else "Not installed.") print("\nExtras Menu:")
continue print(" 1) HydrusNetwork (Setup & Clone)")
if choice in ("q", "quit", "exit"): print(" b) Back")
return 0 extra_choice = input("Choose an extra: ").strip().lower()
else: if extra_choice == "1":
print("1) Install") return "extras_hydrus"
print("q) Quit") continue # back to main menu
choice = input("Choose an option: ").strip().lower()
if not choice or choice in ("1", "install"): if installed and choice in ("3", "uninstall"):
return "install" return "uninstall"
if choice in ("q", "quit", "exit"):
return 0 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: except EOFError:
# Non-interactive, fall back to delegating to platform helper # Non-interactive, fall back to delegating to platform helper
return "delegate" return "delegate"
@@ -780,6 +787,19 @@ def main() -> int:
args.skip_deps = False args.skip_deps = False
args.install_editable = True args.install_editable = True
args.no_playwright = False 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": elif sel == "uninstall":
return _do_uninstall() return _do_uninstall()
elif sel == "delegate": elif sel == "delegate":

View File

@@ -806,6 +806,29 @@ def main(argv: Optional[list[str]] = None) -> int:
if args.verbose: if args.verbose:
logging.getLogger().setLevel(logging.DEBUG) 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() root = Path(args.root).expanduser().resolve()
# Python executable inside the repo venv (set when we create/find the venv) # Python executable inside the repo venv (set when we create/find the venv)
venv_py = None venv_py = None