26 lines
847 B
PowerShell
26 lines
847 B
PowerShell
$ErrorActionPreference = "Stop"
|
|
|
|
$Root = Split-Path -Parent (Split-Path -Parent $MyInvocation.MyCommand.Path)
|
|
Set-Location $Root
|
|
|
|
. "$Root\scripts\stockbot_env.ps1"
|
|
$Python = Resolve-StockBotPython -Project $Root
|
|
$Requirements = Join-Path $Root "requirements.txt"
|
|
$Wheelhouse = Join-Path $Root "vendor\wheels"
|
|
|
|
if (-not (Test-Path $Requirements)) {
|
|
throw "requirements.txt not found: $Requirements"
|
|
}
|
|
|
|
if (Test-Path $Wheelhouse) {
|
|
$WheelFiles = Get-ChildItem -Path $Wheelhouse -Filter "*.whl" -ErrorAction SilentlyContinue
|
|
if ($WheelFiles.Count -gt 0) {
|
|
Write-Host "[install] using local wheelhouse: $Wheelhouse"
|
|
& $Python -m pip install --no-index --find-links $Wheelhouse -r $Requirements
|
|
exit $LASTEXITCODE
|
|
}
|
|
}
|
|
|
|
Write-Host "[install] using online package index"
|
|
& $Python -m pip install -r $Requirements
|