fix: use --clear to create venv (#761)

Fixes: https://github.com/astral-sh/setup-uv/issues/758
This commit is contained in:
Kevin Stillhammer 2026-02-06 10:48:26 +01:00 committed by GitHub
parent b6b8e2cd6a
commit 78cebeceac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 14 additions and 2 deletions

8
dist/setup/index.js generated vendored
View file

@ -96569,7 +96569,13 @@ async function activateEnvironment() {
throw new Error("UV_NO_MODIFY_PATH and activate-environment cannot be used together.");
}
core.info(`Creating and activating python venv at ${inputs_1.venvPath}...`);
await exec.exec("uv", ["venv", inputs_1.venvPath, "--directory", inputs_1.workingDirectory]);
await exec.exec("uv", [
"venv",
inputs_1.venvPath,
"--directory",
inputs_1.workingDirectory,
"--clear",
]);
let venvBinPath = `${inputs_1.venvPath}${path.sep}bin`;
if (process.platform === "win32") {
venvBinPath = `${inputs_1.venvPath}${path.sep}Scripts`;

View file

@ -272,7 +272,13 @@ async function activateEnvironment(): Promise<void> {
}
core.info(`Creating and activating python venv at ${venvPath}...`);
await exec.exec("uv", ["venv", venvPath, "--directory", workingDirectory]);
await exec.exec("uv", [
"venv",
venvPath,
"--directory",
workingDirectory,
"--clear",
]);
let venvBinPath = `${venvPath}${path.sep}bin`;
if (process.platform === "win32") {