| 272 | // ─── Unix dev helper ───────────────────────────────────────────────────────── |
| 273 | |
| 274 | function findSystemPython(): string { |
| 275 | const candidates = ['python3.12', 'python3.11', 'python3.10', 'python3', 'python'] |
| 276 | for (const cmd of candidates) { |
| 277 | try { |
| 278 | const out = execSync(`${cmd} --version`, { encoding: 'utf8', timeout: 3000 }).trim() |
| 279 | if (out.startsWith('Python 3.')) { |
| 280 | console.log(`[PythonSetup] Found system Python: ${cmd} → ${out}`) |
| 281 | return cmd |
| 282 | } |
| 283 | } catch { /* not found */ } |
| 284 | } |
| 285 | throw new Error( |
| 286 | 'Python 3 not found on your system.\n' + |
| 287 | 'Please install Python 3.10+ and try again.\n' + |
| 288 | 'Ubuntu/Debian : sudo apt install python3 python3-venv\n' + |
| 289 | 'macOS : brew install python@3.11' |
| 290 | ) |
| 291 | } |
| 292 | |
| 293 | // ─── Public orchestrator ────────────────────────────────────────────────────── |
| 294 | |