()
| 107 | * @throws Error if neither python nor python3 is found |
| 108 | */ |
| 109 | export function detectDefaultPython(): string { |
| 110 | if (isPythonAvailable('python')) { |
| 111 | return 'python' |
| 112 | } |
| 113 | |
| 114 | if (isPythonAvailable('python3')) { |
| 115 | return 'python3' |
| 116 | } |
| 117 | |
| 118 | throw new Error( |
| 119 | 'No Python executable found.\n\n' + |
| 120 | 'Please ensure Python is installed and available in your PATH,\n' + |
| 121 | 'or specify the path explicitly with --python <path>' |
| 122 | ) |
| 123 | } |
| 124 | |
| 125 | /** |
| 126 | * Checks if the given string is a bare system Python command (e.g. 'python', 'python3', 'python3.11') |
no test coverage detected