Skip to content

Commit

Permalink
don't activate an already activated venv
Browse files Browse the repository at this point in the history
  • Loading branch information
th3w1zard1 committed Feb 24, 2024
1 parent 598187e commit 856d22b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions install_python_venv.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,11 @@ $findVenvExecutable = $true
if (Get-ChildItem Env:VIRTUAL_ENV -ErrorAction SilentlyContinue) { # Check if a venv is already activated
$venvPath = $env:VIRTUAL_ENV
Write-Host "A virtual environment is currently activated: $venvPath"
if ($null -ne $pythonExePath) { # check if this script itself was previously used to activate this venv.
Write-Host "install_python_venv.ps1 has already ran and activated this venv, nothing left to do by rerunning this."
return
}
deactivate
} elseif ($venvPath -ne ($repoRootPath + $pathSep) -and (Test-Path $venvPath -ErrorAction SilentlyContinue)) {
Write-Host "Found existing python virtual environment at '$venvPath'"
} else {
Expand Down

0 comments on commit 856d22b

Please sign in to comment.