diff --git a/scripts/bootstrap.py b/scripts/bootstrap.py index bb3528c..33f9ce3 100644 --- a/scripts/bootstrap.py +++ b/scripts/bootstrap.py @@ -794,16 +794,25 @@ def main() -> int: """Prompt for a clone location when running outside the repository.""" nonlocal repo_root, script_dir, is_in_repo + # If script_path is None, we are running from a pipe/URL. + # In this mode, we ALWAYS want to ask for the directory, + # unless we have already asked and set is_in_repo to True within this session. if is_in_repo and script_path is not None: return True + # If we are in standalone mode and is_in_repo is True, it means we + # just finished cloning/setting up the path in the current execution. + # But we need to be careful: if we haven't asked yet, we must ask. + 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 False try: - if is_in_repo and script_path is not None: + # When piped, script_path is None. We don't want to use the detected repo_root + # because that's just CWD. + if script_path is not None: default_install = repo_root else: default_install = Path.cwd() / "Medios-Macina" @@ -1003,13 +1012,18 @@ def main() -> int: if (sys.stdin.isatty() or sys.stdout.isatty() or script_path is None) and not args.quiet: sel = _interactive_menu() if sel == "install": - # Force the prompt regardless of current environment detection + # Force set is_in_repo to False if piped to ensure _ensure_repo_available asks + if script_path is None: + is_in_repo = False if not _ensure_repo_available(): return 1 args.skip_deps = False args.install_editable = True args.no_playwright = False elif sel == "extras_hydrus": + # Force set is_in_repo to False if piped to ensure _ensure_repo_available asks + if script_path is None: + is_in_repo = False if not _ensure_repo_available(): return 1 hydrus_script = repo_root / "scripts" / "hydrusnetwork.py"