This commit is contained in:
2026-01-21 23:06:43 -08:00
parent 8225221fd3
commit c0aab8e2f9

View File

@@ -518,66 +518,6 @@ def main() -> int:
script_dir = repo_root / "scripts"
is_in_repo = True
# STANDALONE INSTALLER MODE
# If the script is run from a location that doesn't look like a Medios-Macina repo,
# or if we're in a completely empty directory, offer to clone the repo.
if not is_in_repo:
if not args.quiet:
print("\n" + "=" * 60)
print(" MEDEOS-MACINA STANDALONE INSTALLER")
print("=" * 60)
print("No existing Medeos-Macina repository found at this location.")
if script_path:
print(f"Current script location: {script_path}")
# Check for git
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:
# Ask for installation folder
default_install = Path.cwd() / "Medios-Macina"
print(f"\nWhere would you like to install Medeos-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:
print("Non-interactive session: cannot proceed with clone.", file=sys.stderr)
return 1
if not install_path.exists():
print(f"Creating directory: {install_path}")
install_path.mkdir(parents=True, exist_ok=True)
# Check if it already has a repo (user might have chosen an existing folder)
if _is_valid_mm_repo(install_path):
print(f"Found existing repository in {install_path}.")
repo_root = install_path
is_in_repo = True
else:
print(f"Cloning Medeos-Macina into {install_path}...")
print(f"Source: {REPO_URL}")
try:
subprocess.check_call(["git", "clone", REPO_URL, str(install_path)])
repo_root = install_path
is_in_repo = True
except Exception as e:
print(f"Error: Failed to clone repository: {e}", file=sys.stderr)
return 1
# Change directory to the newly established repo root
os.chdir(str(repo_root))
print(f"\nSuccessfully set up repository at {repo_root}")
print("Resuming bootstrap...\n")
# Re-initialize script_dir for the rest of the script
# as if we started inside the repo scripts folder.
script_dir = repo_root / "scripts"
if not args.quiet:
print(f"Bootstrap script location: {script_dir}")
print(f"Detected project root: {repo_root}")
@@ -988,6 +928,51 @@ def main() -> int:
if (sys.stdin.isatty() or sys.stdout.isatty()) and not args.quiet:
sel = _interactive_menu()
if sel == "install":
if 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:
default_install = Path.cwd() / "Medios-Macina"
print(f"\nNo repository found. Where should Medeos-Macina be installed?")
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:
return 1
if not install_path.exists():
print(f"Creating directory: {install_path}")
install_path.mkdir(parents=True, exist_ok=True)
# Check if it already has a repo (user might have chosen an existing folder)
if _is_valid_mm_repo(install_path):
print(f"Found existing repository in {install_path}.")
repo_root = install_path
else:
print(f"Cloning Medeos-Macina into {install_path} (depth 1)...")
print(f"Source: {REPO_URL}")
try:
subprocess.check_call(["git", "clone", "--depth", "1", REPO_URL, str(install_path)])
repo_root = install_path
except Exception as e:
print(f"Error: Failed to clone repository: {e}", file=sys.stderr)
return 1
# Change directory to the newly established repo root
os.chdir(str(repo_root))
print(f"\nSuccessfully set up repository at {repo_root}")
print("Resuming bootstrap...\n")
# Re-initialize script_dir for the rest of the script
# as if we started inside the repo scripts folder.
script_dir = repo_root / "scripts"
is_in_repo = True
# user chose to install/reinstall; set defaults and continue
args.skip_deps = False
args.install_editable = True