Add segmented fallback for unmatched beats
This commit is contained in:
+19
-1
@@ -44,7 +44,25 @@ if ($pythonVersion -notmatch "3\.(1[1-9]|[2-9]\d)") {
|
||||
|
||||
# ---- 2. Create venv ---------------------------------------------------------
|
||||
if (Test-Path $VENV_DIR) {
|
||||
Write-Host "Virtual environment already exists at '$VENV_DIR'. Skipping creation." -ForegroundColor Yellow
|
||||
$existingVenvPython = Join-Path $VENV_DIR "Scripts\python.exe"
|
||||
$venvOk = $false
|
||||
if (Test-Path $existingVenvPython) {
|
||||
try {
|
||||
$existingVersion = & $existingVenvPython --version 2>&1
|
||||
$venvOk = $LASTEXITCODE -eq 0 -and $existingVersion -match "3\.(1[1-9]|[2-9]\d)"
|
||||
} catch {
|
||||
$venvOk = $false
|
||||
}
|
||||
}
|
||||
|
||||
if ($venvOk) {
|
||||
Write-Host "Virtual environment already exists at '$VENV_DIR'. Skipping creation." -ForegroundColor Yellow
|
||||
} else {
|
||||
Write-Host "Existing virtual environment is not usable. Recreating '$VENV_DIR' ..." -ForegroundColor Yellow
|
||||
Remove-Item -LiteralPath $VENV_DIR -Recurse -Force
|
||||
& $PROJECT_PYTHON -m venv $VENV_DIR
|
||||
Write-Host "Done." -ForegroundColor Green
|
||||
}
|
||||
} else {
|
||||
Write-Host "Creating virtual environment in '$VENV_DIR' ..." -ForegroundColor Green
|
||||
& $PROJECT_PYTHON -m venv $VENV_DIR
|
||||
|
||||
Reference in New Issue
Block a user