()
| 350 | } |
| 351 | |
| 352 | function getInstalledPythons(): Set<string> { |
| 353 | if (installedPythonsCache !== null) { |
| 354 | return installedPythonsCache; |
| 355 | } |
| 356 | |
| 357 | if (process.env.VERCEL_BUILD_IMAGE) { |
| 358 | installedPythonsCache = getInstalledPythonsFromFilesystem(); |
| 359 | return installedPythonsCache; |
| 360 | } |
| 361 | |
| 362 | const uvPath = findUvInPath(); |
| 363 | if (!uvPath) { |
| 364 | throw new NowBuildError({ |
| 365 | code: 'UV_ERROR', |
| 366 | link: 'https://vercel.link/python-version', |
| 367 | message: 'uv is required but was not found in PATH.', |
| 368 | }); |
| 369 | } |
| 370 | const uv = new UvRunner(uvPath); |
| 371 | installedPythonsCache = uv.listInstalledPythons(); |
| 372 | return installedPythonsCache; |
| 373 | } |
| 374 | |
| 375 | /** |
| 376 | * Reset the installed Python versions cache. |
no test coverage detected