(pythonPath: string)
| 295 | } |
| 296 | |
| 297 | async function getUserScriptsDir(pythonPath: string): Promise<string | null> { |
| 298 | const code = |
| 299 | `import sys, sysconfig; print(sysconfig.get_path('scripts', scheme=('nt_user' if sys.platform == 'win32' else 'posix_user')))`.replace( |
| 300 | /\n/g, |
| 301 | ' ' |
| 302 | ); |
| 303 | try { |
| 304 | const { stdout } = await execa(pythonPath, ['-c', code]); |
| 305 | const out = stdout.trim(); |
| 306 | return out || null; |
| 307 | } catch (err) { |
| 308 | debug('Failed to resolve Python user scripts directory', err); |
| 309 | return null; |
| 310 | } |
| 311 | } |
| 312 | |
| 313 | export async function findUvBinary(pythonPath: string): Promise<string | null> { |
| 314 | const buildImageUv = findUvOnBuildImage(); |
no test coverage detected