This commit is contained in:
2026-01-22 03:39:28 -08:00
parent 4c69f43ac2
commit 816444b9db

View File

@@ -865,6 +865,29 @@ def main() -> int:
# Non-interactive, fall back to delegating to platform helper
return "delegate"
def _prompt_hydrus_install_location() -> tuple[Path, str] | None:
"""Ask the user for the Hydrus installation root and folder name."""
default_root = Path.home()
default_dest_name = "hydrusnetwork"
print("\n[Standalone Hydrus Installation]")
print("Choose where to install HydrusNetwork (the installer will create the repo there).")
try:
root_input = input(f"Root directory [{default_root}]: ").strip()
if root_input:
if len(root_input) == 2 and root_input[1] == ":" and root_input[0].isalpha():
root_input += "\\"
expanded = os.path.expandvars(os.path.expanduser(root_input))
root_path = Path(expanded).resolve()
else:
root_path = default_root
dest_input = input(f"Folder name [{default_dest_name}]: ").strip()
dest_name = dest_input or default_dest_name
return root_path, dest_name
except (EOFError, KeyboardInterrupt):
print("\nHydrus installation cancelled.")
return None
def _clone_repo(url: str, dest: Path, depth: int = 1) -> bool:
"""Helper to clone a repository."""
try:
@@ -1131,6 +1154,11 @@ def main() -> int:
return 1
if hydrus_script.exists():
install_location = _prompt_hydrus_install_location()
if install_location is None:
return 0
install_root, install_dest = install_location
try:
# Clear out project-venv related env vars to prevent auto-reexec
env = os.environ.copy()
@@ -1141,7 +1169,15 @@ def main() -> int:
# This ensures it uses the same environment that started the bootstrap.
# Pass sys.stdin to ensure the subprocess can talk to the terminal.
subprocess.check_call(
[sys.executable, str(hydrus_script), "--no-project-venv", "--interactive"],
[
sys.executable,
str(hydrus_script),
"--no-project-venv",
"--root",
str(install_root),
"--dest-name",
install_dest,
],
env=env,
stdin=sys.stdin
)