MCPcopy
hub / github.com/lightningpixel/modly / findSystemPython

Function findSystemPython

electron/main/python-setup.ts:274–291  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

272// ─── Unix dev helper ─────────────────────────────────────────────────────────
273
274function 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

Callers 1

runFullSetupFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected