About Multi-camera viewer optimized for RTSP streams
1param(
2 [string]$PythonExe = "py",
3 [string]$AppName = "wildcam",
4 [string]$EntryPoint = "main.py",
5 [string]$ArtifactSuffix = ""
6)
7
8$ErrorActionPreference = "Stop"
9
10$repoRoot = Split-Path -Parent $PSScriptRoot
11Set-Location $repoRoot
12
13if (!(Test-Path $EntryPoint)) {
14 throw "Entry point not found: $EntryPoint"
15}
16
17$venvDir = Join-Path $repoRoot ".venv"
18$distDir = Join-Path $repoRoot "dist"
19$buildDir = Join-Path $repoRoot "build"
20
21if (!(Test-Path $venvDir)) {
22 & $PythonExe -m venv $venvDir
23}
24
25$python = Join-Path $venvDir "Scripts\python.exe"
26$pip = Join-Path $venvDir "Scripts\pip.exe"
27
28& $python -m pip install --upgrade pip
29
30if (Test-Path "requirements.txt") {
31 & $pip install -r "requirements.txt"
32}
33
34& $pip install "pyinstaller>=6.0"
35
36if (Test-Path $distDir) { Remove-Item $distDir -Recurse -Force }
37if (Test-Path $buildDir) { Remove-Item $buildDir -Recurse -Force }
38
39& $python -m PyInstaller `
40 --noconfirm `
41 --clean `
42 --onedir `
43 --windowed `
44 --name $AppName `
45 --add-data "assets/icons;assets/icons" `
46 --collect-all "PyQt6" `
47 --collect-all "cv2" `
48 --collect-all "numpy" `
49 --exclude-module "ultralytics" `
50 --exclude-module "torch" `
51 --exclude-module "torchvision" `
52 --exclude-module "nvidia" `
53 --hidden-import "detection" `
54 --hidden-import "notifications" `
55 $EntryPoint
56
57$bundlePath = Join-Path $distDir $AppName
58if (!(Test-Path $bundlePath)) {
59 throw "Build failed: bundle not found at $bundlePath"
60}
61
62$extraFiles = @(
63 "README.md",
64 "docker-compose.yml",
65 "reolinkproxy_manager.py",
66 "camera_config.json.example"
67)
68
69foreach ($extraFile in $extraFiles) {
70 if (Test-Path $extraFile) {
71 Copy-Item $extraFile -Destination $bundlePath -Force
72 }
73}
74
75if ([string]::IsNullOrWhiteSpace($ArtifactSuffix)) {
76 $ArtifactSuffix = Get-Date -Format "yyyyMMdd_HHmmss"
77}
78
79$zipName = ("{0}_windows_{1}.zip" -f $AppName, $ArtifactSuffix)
80$zipPath = Join-Path $distDir $zipName
81
82if (Test-Path $zipPath) { Remove-Item $zipPath -Force }
83Compress-Archive -Path $bundlePath -DestinationPath $zipPath
84
85Write-Host "BUNDLE: $bundlePath"
86Write-Host "ZIP: $zipPath"