-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.ps1
More file actions
37 lines (32 loc) · 1.26 KB
/
install.ps1
File metadata and controls
37 lines (32 loc) · 1.26 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
# GraphStack v4 Installer — thin PowerShell shim that delegates to the Python core.
# Real logic lives in scripts/graphstack/installer.py.
#
# Usage: .\install.ps1 [target] [-y|--non-interactive]
$ErrorActionPreference = 'Stop'
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$packageParent = Join-Path $scriptDir 'scripts'
$env:PYTHONPATH = if ($env:PYTHONPATH) {
"$packageParent;$env:PYTHONPATH"
} else {
$packageParent
}
function Resolve-Python {
# On Windows, prefer `py -3` because `python.exe` is often the Microsoft
# Store redirect stub which prints a localized error and exits 9009.
$py = Get-Command 'py' -ErrorAction SilentlyContinue
if ($py) { return [pscustomobject]@{ Exe = $py.Source; PreArgs = @('-3') } }
foreach ($name in @('python3', 'python')) {
$cmd = Get-Command $name -ErrorAction SilentlyContinue
if (-not $cmd) { continue }
if ($cmd.Source -match 'WindowsApps') { continue }
return [pscustomobject]@{ Exe = $cmd.Source; PreArgs = @() }
}
return $null
}
$python = Resolve-Python
if (-not $python) {
Write-Error 'GraphStack: Python 3.8+ is required but was not found on PATH.'
exit 127
}
& $python.Exe @($python.PreArgs) -m graphstack install @args
exit $LASTEXITCODE