-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild-gui.ps1
More file actions
42 lines (32 loc) · 1.05 KB
/
build-gui.ps1
File metadata and controls
42 lines (32 loc) · 1.05 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
#!/usr/bin/env pwsh
<#
.SYNOPSIS
Build the notes-gui desktop app with PyInstaller.
#>
[CmdletBinding()]
param()
Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'
function Get-PythonCommand {
foreach ($candidate in @('python', 'python3')) {
if (Get-Command $candidate -ErrorAction SilentlyContinue) {
return $candidate
}
}
throw "Python 3 is required to build notes-gui."
}
$repoRoot = Split-Path -Parent $PSCommandPath
Set-Location $repoRoot
$python = Get-PythonCommand
$venvPath = Join-Path $repoRoot '.venv-gui-build'
if (-not (Test-Path $venvPath)) {
& $python -m venv $venvPath
}
$venvPython = if ($IsWindows -or $env:OS -eq 'Windows_NT') {
Join-Path $venvPath 'Scripts\python.exe'
} else {
Join-Path $venvPath 'bin/python'
}
& $venvPython -m pip install --disable-pip-version-check -r .\requirements-gui.txt pyinstaller
& $venvPython -m PyInstaller --noconfirm --name notes-gui --windowed .\gui\main.py
Write-Host "notes-gui build completed under .\dist\notes-gui" -ForegroundColor Green