Files

15 lines
851 B
PowerShell

$ErrorActionPreference = 'Stop'
$taskRoot = Split-Path $PSScriptRoot -Parent
Set-Location -LiteralPath $taskRoot
$taskEnvironment = Join-Path $PSScriptRoot '.venv'
if (-not (Test-Path -LiteralPath (Join-Path $taskEnvironment 'Scripts\python.exe'))) {
python -m venv $taskEnvironment
if ($LASTEXITCODE -ne 0) { throw 'Could not create the dedicated Python environment.' }
}
& (Join-Path $taskEnvironment 'Scripts\python.exe') -m pip install -r (Join-Path $PSScriptRoot 'requirements.txt')
if ($LASTEXITCODE -ne 0) { throw 'Could not install the MT5 app requirements.' }
if (-not (Test-Path -LiteralPath (Join-Path $PSScriptRoot '.env'))) {
Copy-Item -LiteralPath (Join-Path $PSScriptRoot '.env.example') -Destination (Join-Path $PSScriptRoot '.env')
}
Write-Output 'Ready. Open and log in to the Pi MT5 terminal, then run mt5_app/run.ps1.'