-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathrun.ps1
More file actions
40 lines (37 loc) · 1.03 KB
/
Copy pathrun.ps1
File metadata and controls
40 lines (37 loc) · 1.03 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
#!/usr/bin/env pwsh
param(
[string]$Python = "python",
[switch]$Smoke,
[int]$TimeoutSeconds = 30,
[int]$Major = 2,
[int]$Minor = 3
)
$ErrorActionPreference = "Stop"
if (-not (Test-Path -LiteralPath (Join-Path $PSScriptRoot "generated\__init__.py"))) {
throw "Generated bindings were not found. Run generate.ps1 first."
}
if (-not (Test-Path -LiteralPath (Join-Path $PSScriptRoot ".runtime\Microsoft.WindowsAppRuntime.Bootstrap.dll"))) {
throw "The WinAppSDK bootstrap DLL was not found. Run generate.ps1 first."
}
if (-not [System.IO.Path]::IsPathRooted($Python)) {
$callerPython = Join-Path (Get-Location).Path $Python
if (Test-Path -LiteralPath $callerPython -PathType Leaf) {
$Python = [System.IO.Path]::GetFullPath($callerPython)
}
}
$arguments = @(
(Join-Path $PSScriptRoot "app.py"),
"--timeout",
$TimeoutSeconds,
"--major",
$Major,
"--minor",
$Minor
)
if ($Smoke) {
$arguments += "--smoke"
}
& $Python @arguments
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}