diff --git a/scripts/install-backend.js b/scripts/install-backend.js index d1507a08..a90372b7 100644 --- a/scripts/install-backend.js +++ b/scripts/install-backend.js @@ -26,11 +26,11 @@ function run(cmd, options = {}) { } } -// Find Python 3.12 +// Find Python 3.12+ function findPython() { const candidates = isWindows - ? ['py -3.12', 'python3.12', 'python'] - : ['python3.12', 'python3', 'python']; + ? ['py -3.14', 'py -3.13', 'py -3.12', 'python3.14', 'python3.13', 'python3.12', 'python3', 'python'] + : ['python3.14', 'python3.13', 'python3.12', 'python3', 'python']; for (const cmd of candidates) { try { @@ -38,9 +38,17 @@ function findPython() { encoding: 'utf8', shell: true, }); - if (result.status === 0 && result.stdout.includes('3.12')) { - console.log(`Found Python 3.12: ${cmd} -> ${result.stdout.trim()}`); - return cmd; + // Accept Python 3.12+ using proper version parsing + if (result.status === 0) { + const versionMatch = result.stdout.match(/Python (\d+)\.(\d+)/); + if (versionMatch) { + const major = parseInt(versionMatch[1], 10); + const minor = parseInt(versionMatch[2], 10); + if (major === 3 && minor >= 12) { + console.log(`Found Python 3.12+: ${cmd} -> ${result.stdout.trim()}`); + return cmd; + } + } } } catch (e) { // Continue to next candidate @@ -58,11 +66,11 @@ function getPipPath() { // Main installation async function main() { - // Check for Python 3.12 + // Check for Python 3.12+ const python = findPython(); if (!python) { - console.error('\nError: Python 3.12 is required but not found.'); - console.error('Please install Python 3.12:'); + console.error('\nError: Python 3.12+ is required but not found.'); + console.error('Please install Python 3.12 or higher:'); if (isWindows) { console.error(' winget install Python.Python.3.12'); } else if (os.platform() === 'darwin') {