-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.ps1
More file actions
50 lines (41 loc) · 1.59 KB
/
build.ps1
File metadata and controls
50 lines (41 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# =========================================================
# WinHtop PowerShell Project Builder (v1 and onwards)
# =========================================================
$scriptDir = Split-Path -Parent
$MyInvocation.MyCommand.Path
$targetDir = Join-path $scriptDir "winhtop"
$repoUrl = "https://github.com/ThatOneFBIAgent/winhtop.git"
# Check for PyInstaller
if (!(Get-Command pyinstaller -ErrorAction SilentlyContinue)) {
Write-Error "PyInstaller not found. Please run: pip install pyinstaller sounddevice numpy psutil"
return
}
if (-not (Test-Path $targetDir)) {
Write-Host "winhtop not found. Cloning repo"
git clone $repoUrl $targetDir
if ($LASTEXITCODE -ne 0) {
Write-Error "Failed to clone repo. Please check your internet connection and try again."
return
}
}
else {
Write-Host "winhtop found."
}
Set-Location $targetDir
Write-Host "Building WinHtop EXE..." -ForegroundColor Cyan
# --collect-all is mandatory for sounddevice to bundle the PortAudio DLLs.
# We remove numpy collection because PyInstaller's built-in hooks handle it
# much more efficiently without bundling every single test and doc file.
pyinstaller --onefile `
--name winhtop `
--icon="assets\winhtop.ico" `
--collect-all sounddevice `
--hidden-import sounddevice `
task_manager.py
if ($LASTEXITCODE -eq 0) {
Write-Host "`nBuild Successful! The EXE is in the 'dist' folder." -ForegroundColor Green
Write-Host "You can now run .\install.ps1 to update your installation/path." -ForegroundColor Yellow
}
else {
Write-Error "Build failed with exit code $LASTEXITCODE"
}