execWithResult("{$candidate} --version", false); if ($code === 0) { $python = $candidate; break; } } if ($python === null) { throw new EnvironmentException('meson needs Python 3 on PATH. Install it from https://www.python.org or with `winget install Python.Python.3.13`.'); } if (is_dir($venv)) { FileSystem::removeDir($venv); } cmd()->exec("{$python} -m venv \"{$venv}\"") ->exec("\"{$venv}\\Scripts\\python.exe\" -m pip install --no-index --no-deps \"{$target_path}\""); FileSystem::writeFile("{$dir}\\meson.bat", "@echo off\r\n\"%~dp0venv\\Scripts\\meson.exe\" %*\r\n"); } }