Skip to content

Commit c94720d

Browse files
authored
Merge pull request #85086 from compnerd/stopwatch
build.ps1: repair `Get-Dependencies` and silence output further
2 parents d80d607 + f44a845 commit c94720d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

utils/build.ps1

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,6 +1131,7 @@ function Get-Dependencies {
11311131
Write-Host " $Description"
11321132
}
11331133

1134+
$Stopwatch = [Diagnostics.Stopwatch]::StartNew()
11341135
Write-Host "[$([DateTime]::Now.ToString("yyyy-MM-dd HH:mm:ss"))] Get-Dependencies ..." -ForegroundColor Cyan
11351136
$ProgressPreference = "SilentlyContinue"
11361137

@@ -1141,7 +1142,7 @@ function Get-Dependencies {
11411142
return
11421143
}
11431144

1144-
Write-Output "$Destination not found. Downloading ..."
1145+
# Write-Output "$Destination not found. Downloading ..."
11451146
if ($ToBatch) {
11461147
Write-Output "md `"$(Split-Path -Path $Destination -Parent)`""
11471148
Write-Output "curl.exe -sL $URL -o $Destination"
@@ -1174,7 +1175,7 @@ function Get-Dependencies {
11741175
$ExtractedLastWriteTime = (Get-Item $Destination).LastWriteTime
11751176
# Compare the last write times
11761177
if ($ZipLastWriteTime -le $ExtractedLastWriteTime) {
1177-
Write-Output "'$ZipFileName' is already extracted and up to date."
1178+
# Write-Output "'$ZipFileName' is already extracted and up to date."
11781179
return
11791180
}
11801181
}
@@ -1279,7 +1280,7 @@ function Get-Dependencies {
12791280

12801281
function Test-PythonModuleInstalled([string] $ModuleName) {
12811282
try {
1282-
Invoke-Program -Silent "$(Get-PythonExecutable)" -c "import $ModuleName"
1283+
Invoke-Program -Silent "$(Get-PythonExecutable)" -c "import importlib.util, sys; sys.exit(0 if importlib.util.find_spec('$ModuleName') else 1)"
12831284
return $true
12841285
} catch {
12851286
return $false

0 commit comments

Comments
 (0)