-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild_dist.ps1
More file actions
56 lines (47 loc) · 1.97 KB
/
build_dist.ps1
File metadata and controls
56 lines (47 loc) · 1.97 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
51
52
53
54
55
56
# Build script for Whisper Typing distribution
# This script uses PyInstaller via uv to create a standalone executable
$projectName = "whisper-typing"
$distPath = "dist/$projectName"
# 1. Cleanup old builds
if (Test-Path "build") {
Write-Host "Cleaning up build directory..." -ForegroundColor Cyan
Remove-Item -Path "build" -Recurse -Force
}
if (Test-Path $distPath) {
Write-Host "Cleaning up old distribution..." -ForegroundColor Cyan
Remove-Item -Path $distPath -Recurse -Force
}
# 2. Run PyInstaller
Write-Host "Starting build process for $projectName..." -ForegroundColor Green
Write-Host "This may take a few minutes due to heavy dependencies (Torch, Faster-Whisper)..." -ForegroundColor Yellow
uv run pyinstaller `
--noconfirm `
--onedir `
--console `
--name "$projectName" `
--collect-all "whisper_typing" `
--collect-all "textual" `
--collect-all "faster_whisper" `
--hidden-import "pynput.keyboard._win32" `
--hidden-import "pynput.mouse._win32" `
--paths "src" `
"src/whisper_typing/__main__.py"
if ($LASTEXITCODE -ne 0) {
Write-Host "Build failed!" -ForegroundColor Red
exit $LASTEXITCODE
}
# 3. Post-build: Copy configuration templates
Write-Host "Build successful! Preparing distribution folder..." -ForegroundColor Green
if (Test-Path "config.json") {
Write-Host "Copying config.json..." -ForegroundColor Gray
Copy-Item "config.json" "$distPath/config.json"
}
# Create a template .env file if it doesn't exist in dist
$envTemplate = "# Add your Gemini API Key here`nGEMINI_API_KEY="
if (-not (Test-Path "$distPath/.env")) {
Write-Host "Creating .env template..." -ForegroundColor Gray
$envTemplate | Out-File -FilePath "$distPath/.env" -Encoding utf8
}
Write-Host "`nBuild Complete!" -ForegroundColor Green
Write-Host "The executable and its dependencies are located in: $(Get-Item $distPath).FullName" -ForegroundColor Cyan
Write-Host "Run it by executing: $distPath/$projectName.exe" -ForegroundColor Yellow