#!/usr/bin/env python3
"""Check Python versions and z-image-turbo info on BC-250."""
import paramiko

ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.connect('192.168.178.150', username='fabian', key_filename=r'C:\Users\fabia\.ssh\id_ed25519')

cmds = [
    ("Python 3.12 available?", "pacman -Ss python | grep -E 'python3\\.1[0-3]|python 3\\.' 2>&1 | head -20"),
    ("All python packages", "pacman -Q | grep python 2>&1 | head -30"),
    ("pip via python", "python3 -m pip --version 2>&1"),
    ("pip package", "pacman -Q python-pip 2>&1"),
    ("check pyenv", "which pyenv 2>&1; pacman -Q pyenv 2>&1"),
    ("check python3.12", "which python3.12 2>&1; pacman -Q python312 2>&1; ls /usr/bin/python3.1* 2>&1"),
    ("ninja available", "pacman -Ss '^ninja$' 2>&1 | head -5"),
    ("check ccache", "which ccache 2>&1; pacman -Q ccache 2>&1"),
    ("check z-image-turbo", "pacman -Ss z-image 2>&1; pip3 search z-image-turbo 2>&1 || true"),
    ("check huggingface tools", "pacman -Q | grep -i hugging 2>&1; python3 -c 'import huggingface_hub' 2>&1 || true"),
]

for label, cmd in cmds:
    print(f"\n{'='*60}")
    print(f"  {label}")
    print(f"{'='*60}")
    _, stdout, stderr = ssh.exec_command(cmd, timeout=30)
    out = stdout.read().decode()
    err = stderr.read().decode()
    if out.strip():
        print(out.strip())
    if err.strip():
        print(f"STDERR: {err.strip()}")

ssh.close()
