fix: install env path issue

This commit is contained in:
Wendong-Fan 2025-11-27 15:04:34 +08:00
parent 644d3a9727
commit 1bd795a119
3 changed files with 47 additions and 12 deletions

View file

@ -142,3 +142,18 @@ export async function isBinaryExists(name: string): Promise<boolean> {
return await fs.existsSync(cmd)
}
/**
* Get unified UV environment variables for consistent Python environment management.
* This ensures both installation and runtime use the same paths.
* @param version - The app version for venv path
* @returns Environment variables for UV commands
*/
export function getUvEnv(version: string): Record<string, string> {
return {
UV_PYTHON_INSTALL_DIR: getCachePath('uv_python'),
UV_TOOL_DIR: getCachePath('uv_tool'),
UV_PROJECT_ENVIRONMENT: getVenvPath(version),
UV_HTTP_TIMEOUT: '180',
}
}