Skip to content

Commit 8f322a5

Browse files
Fix PowerShell string parsing: delimit ${name} in install.ps1 messages
1 parent 1894484 commit 8f322a5

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

scripts/install.ps1

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -441,12 +441,12 @@ function Install-OneRepo($owner, $name, $pkg, $desc, $url, $idx, $total) {
441441
if ((Normalize-RemoteUrl $existingUrl) -eq (Normalize-RemoteUrl $url)) {
442442
$destHasRepo = $true
443443
} else {
444-
Write-Fail "$name: destination is a git repo for a different remote" $existingUrl
444+
Write-Fail "${name}: destination is a git repo for a different remote" $existingUrl
445445
Record-Repo $name "FAIL" "wrong remote at $destAbs"
446446
return
447447
}
448448
} else {
449-
Write-Fail "$name: destination exists and is not empty" $destAbs
449+
Write-Fail "${name}: destination exists and is not empty" $destAbs
450450
Record-Repo $name "FAIL" "destination not empty"
451451
return
452452
}
@@ -462,34 +462,34 @@ function Install-OneRepo($owner, $name, $pkg, $desc, $url, $idx, $total) {
462462
Write-Cmd "git -C $destAbs pull --ff-only"
463463
& $GitBin -C $destAbs pull --ff-only
464464
if ($LASTEXITCODE -eq 0) { Write-Pass "$name updated" }
465-
else { Write-Warn2 "$name: git pull failed; using existing state"; $repoState = "WARN" }
466-
} else { Write-Skip "$name: using existing clone as-is" }
465+
else { Write-Warn2 "${name}: git pull failed; using existing state"; $repoState = "WARN" }
466+
} else { Write-Skip "${name}: using existing clone as-is" }
467467
} else {
468468
if ($Branch) { Write-Host (" Will clone {0} (branch: {1}) into {2}." -f $url, $Branch, $destAbs) }
469469
else { Write-Host (" Will clone {0} into {1}." -f $url, $destAbs) }
470470
$doClone = $true
471471
if ($PerStep) { if (-not (Prompt-YN "Clone now?" 'y')) { $doClone = $false } }
472-
if (-not $doClone) { Write-Fail "$name: clone declined"; Record-Repo $name "FAIL" "clone declined"; return }
472+
if (-not $doClone) { Write-Fail "${name}: clone declined"; Record-Repo $name "FAIL" "clone declined"; return }
473473
if ($Branch) {
474474
Write-Cmd "git clone --branch $Branch $url $destAbs"
475475
& $GitBin clone --branch $Branch $url $destAbs
476476
} else {
477477
Write-Cmd "git clone $url $destAbs"
478478
& $GitBin clone $url $destAbs
479479
}
480-
if ($LASTEXITCODE -ne 0) { Write-Fail "$name: git clone failed"; Record-Repo $name "FAIL" "git clone failed"; return }
480+
if ($LASTEXITCODE -ne 0) { Write-Fail "${name}: git clone failed"; Record-Repo $name "FAIL" "git clone failed"; return }
481481
$branchNow = "?"
482482
try { $branchNow = (& $GitBin -C $destAbs rev-parse --abbrev-ref HEAD 2>$null).Trim() } catch {}
483483
Write-Pass "$name cloned" "$destAbs (branch: $branchNow)"
484484
}
485485

486486
# --- Verify the repo is uv-native ---
487487
if (-not (Test-Path (Join-Path $destAbs "pyproject.toml"))) {
488-
Write-Fail "$name: no pyproject.toml (not a uv-native repo)"
488+
Write-Fail "${name}: no pyproject.toml (not a uv-native repo)"
489489
Record-Repo $name "FAIL" "no pyproject.toml"
490490
return
491491
}
492-
if (-not (Test-Path (Join-Path $destAbs "uv.lock"))) { Write-Warn2 "$name: no uv.lock; uv sync will create one" }
492+
if (-not (Test-Path (Join-Path $destAbs "uv.lock"))) { Write-Warn2 "${name}: no uv.lock; uv sync will create one" }
493493

494494
# --- uv sync ---
495495
$syncArgs = @("sync")
@@ -499,34 +499,34 @@ function Install-OneRepo($owner, $name, $pkg, $desc, $url, $idx, $total) {
499499
Write-Host " Will run: uv $($syncArgs -join ' ') (in $destAbs)"
500500
if (-not (Prompt-YN "Run uv sync now?" 'y')) { $doSync = $false }
501501
}
502-
if (-not $doSync) { Write-Fail "$name: uv sync declined"; Record-Repo $name "FAIL" "uv sync declined"; return }
502+
if (-not $doSync) { Write-Fail "${name}: uv sync declined"; Record-Repo $name "FAIL" "uv sync declined"; return }
503503
Write-Cmd "uv $($syncArgs -join ' ') (cwd: $destAbs)"
504504
Push-Location $destAbs
505505
$syncRc = 1
506506
try { & $UvBin @syncArgs; $syncRc = $LASTEXITCODE } finally { Pop-Location }
507-
if ($syncRc -ne 0) { Write-Fail "$name: uv sync failed"; Record-Repo $name "FAIL" "uv sync failed"; return }
507+
if ($syncRc -ne 0) { Write-Fail "${name}: uv sync failed"; Record-Repo $name "FAIL" "uv sync failed"; return }
508508
Write-Pass "$name installed (uv sync)"
509509

510510
# --- Verify import ---
511511
$venvPy = Join-Path $destAbs ".venv\Scripts\python.exe"
512512
if (-not (Test-Path $venvPy)) {
513-
Write-Fail "$name: venv python not found" $venvPy
513+
Write-Fail "${name}: venv python not found" $venvPy
514514
Record-Repo $name "FAIL" "no venv python"
515515
return
516516
}
517517
& $venvPy -W ignore -c "import $pkg" 2>&1 | Out-Null
518518
if ($LASTEXITCODE -eq 0) {
519519
$ver = "?"
520520
try { $ver = (& $venvPy -W ignore -c "import $pkg; print(getattr($pkg, '__version__', '?'))" 2>&1 | Select-Object -Last 1).ToString().Trim() } catch {}
521-
Write-Pass "$name: import $pkg" $ver
521+
Write-Pass "${name}: import $pkg" $ver
522522
if ($repoState -eq "WARN") { Record-Repo $name "WARN" "import $pkg ($ver); pull warning" }
523523
else { Record-Repo $name "PASS" "import $pkg ($ver)" }
524524
} else {
525-
Write-Fail "$name: import $pkg failed" "package not importable; check log above"
525+
Write-Fail "${name}: import $pkg failed" "package not importable; check log above"
526526
Record-Repo $name "FAIL" "import $pkg failed"
527527
}
528528
} catch {
529-
Write-Fail "$name: unexpected error" $_.Exception.Message
529+
Write-Fail "${name}: unexpected error" $_.Exception.Message
530530
Record-Repo $name "FAIL" "error: $($_.Exception.Message)"
531531
}
532532
}

0 commit comments

Comments
 (0)