# Build myGarmin-setup-.exe: PyInstaller (one folder, Python included) -> Inno Setup installer. # Needs: pip install pyinstaller ; Inno Setup 6 (winget install JRSoftware.InnoSetup). # usage (from the repo): powershell -ExecutionPolicy Bypass -File packaging\build.ps1 $ErrorActionPreference = 'Stop' $here = Split-Path -Parent $MyInvocation.MyCommand.Path Set-Location $here $version = (Select-String -Path ..\pyproject.toml -Pattern '^version = "(.+)"').Matches[0].Groups[1].Value $v4 = (($version -split '\.') + @('0', '0', '0'))[0..3] -join ', ' # Windows file version resource for myGarmin.exe @" VSVersionInfo(ffi=FixedFileInfo(filevers=($v4), prodvers=($v4)), kids=[StringFileInfo([StringTable('040904B0', [StringStruct('ProductName', 'myGarmin'), StringStruct('FileDescription', 'myGarmin activity and health logbook'), StringStruct('FileVersion', '$version'), StringStruct('ProductVersion', '$version'), StringStruct('LegalCopyright', 'MIT licence')])]), VarFileInfo([VarStruct('Translation', [1033, 1200])])]) "@ | Out-File -Encoding utf8 version_info.txt python -m PyInstaller --noconfirm --clean --distpath ..\build\dist --workpath ..\build\work myGarmin.spec if ($LASTEXITCODE) { throw 'PyInstaller failed' } $iscc = @("$env:LOCALAPPDATA\Programs\Inno Setup 6\ISCC.exe", "${env:ProgramFiles(x86)}\Inno Setup 6\ISCC.exe", "$env:ProgramFiles\Inno Setup 6\ISCC.exe") | Where-Object { Test-Path $_ } | Select-Object -First 1 if (-not $iscc) { throw 'Inno Setup 6 not found (winget install JRSoftware.InnoSetup)' } & $iscc "/DAppVersion=$version" myGarmin.iss if ($LASTEXITCODE) { throw 'Inno Setup failed' } Get-Item ..\build\installer\*.exe | Select-Object Name, @{n='MB'; e={[math]::Round($_.Length / 1MB, 1)}}