27 lines
909 B
PowerShell
27 lines
909 B
PowerShell
param(
|
|
[string]$Prefix = (Join-Path $env:LOCALAPPDATA "bjd-cms"),
|
|
[string]$Python = ""
|
|
)
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
$ScriptDirectory = Split-Path -Parent $MyInvocation.MyCommand.Path
|
|
$Installer = Join-Path $ScriptDirectory "install.py"
|
|
$PythonArguments = @()
|
|
|
|
if ($Python) {
|
|
$PythonCommand = $Python
|
|
} elseif (Get-Command python -CommandType Application -ErrorAction SilentlyContinue) {
|
|
$PythonCommand = "python"
|
|
} elseif (Get-Command python3 -CommandType Application -ErrorAction SilentlyContinue) {
|
|
$PythonCommand = "python3"
|
|
} elseif (Get-Command py -CommandType Application -ErrorAction SilentlyContinue) {
|
|
$PythonCommand = "py"
|
|
$PythonArguments = @("-3")
|
|
} else {
|
|
Write-Error "Python 3.10 or newer was not found. Install Python or pass -Python with its executable path."
|
|
exit 2
|
|
}
|
|
|
|
& $PythonCommand @PythonArguments $Installer --prefix $Prefix
|
|
exit $LASTEXITCODE
|