* Asserts that the Python version is 3.x
()
| 381 | * Asserts that the Python version is 3.x |
| 382 | */ |
| 383 | protected async validatePythonVersion() { |
| 384 | log.debug(`Validating ${NAME_PYTHON} version`); |
| 385 | |
| 386 | const pythonPath = this.pythonPath ?? (await findPython()); |
| 387 | if (!pythonPath) { |
| 388 | return this.fail(MESSAGE_PYTHON_MISSING); |
| 389 | } |
| 390 | |
| 391 | try { |
| 392 | const {stdout} = await exec(pythonPath, ['--version']); |
| 393 | if (!stdout.includes(PYTHON_VER_STR)) { |
| 394 | return this.fail(`Could not find Python 3.x in PATH; found ${stdout}`); |
| 395 | } |
| 396 | } catch { |
| 397 | return this.fail(`Could not retrieve Python version`); |
| 398 | } |
| 399 | this.ok('Python version OK'); |
| 400 | } |
| 401 | } |