-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwalltext_manager.ps1
More file actions
41 lines (34 loc) · 1.18 KB
/
Copy pathwalltext_manager.ps1
File metadata and controls
41 lines (34 loc) · 1.18 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
param(
[string]$ConfigPath = "",
[Parameter(ValueFromRemainingArguments = $true)]
[string[]]$ExtraArgs
)
$ErrorActionPreference = "Stop"
function Get-PythonExecutable {
$pyCommand = Get-Command py -ErrorAction SilentlyContinue
if ($pyCommand) {
$exe = & py -3 -c "import sys; print(sys.executable)" 2>$null
if ($LASTEXITCODE -eq 0 -and $exe) {
return $exe.Trim()
}
$exe = & py -c "import sys; print(sys.executable)" 2>$null
if ($LASTEXITCODE -eq 0 -and $exe) {
return $exe.Trim()
}
}
$pythonCommand = Get-Command python -ErrorAction SilentlyContinue
if ($pythonCommand) {
$exe = & python -c "import sys; print(sys.executable)" 2>$null
if ($LASTEXITCODE -eq 0 -and $exe) {
return $exe.Trim()
}
}
throw "Python was not found. Run install_dependencies.bat first."
}
if ([string]::IsNullOrWhiteSpace($ConfigPath)) {
$ConfigPath = Join-Path $env:LOCALAPPDATA "walltext\walltext.json"
}
$pythonExecutable = Get-PythonExecutable
$argsList = @("-m", "walltext", "manager", "--config", $ConfigPath) + $ExtraArgs
& $pythonExecutable @argsList
exit $LASTEXITCODE