11Set-Location ../
22
3+ # Function to get the venv python path based on OS and relative path
4+ function Get-VenvPythonPath {
5+ param ([string ]$relativePath )
6+ if ($IsLinux -or $IsMacOS ) {
7+ return " $relativePath /bin/python"
8+ } else {
9+ return " $relativePath /Scripts/python.exe"
10+ }
11+ }
12+
313Write-Host ' Creating python virtual environment ".venv"'
414$pythonCmd = Get-Command python - ErrorAction SilentlyContinue
515if (-not $pythonCmd ) {
@@ -12,11 +22,7 @@ Write-Host ""
1222Write-Host " Restoring backend python packages"
1323Write-Host " "
1424
15- $venvPythonPath = " ./.venv/Scripts/python.exe"
16- if (Test-Path - Path " /usr" ) {
17- # fallback to Linux venv path
18- $venvPythonPath = " ./.venv/bin/python"
19- }
25+ $venvPythonPath = Get-VenvPythonPath " ./.venv"
2026
2127Start-Process - FilePath $venvPythonPath - ArgumentList " -m pip install -r app/backend/requirements.txt" - Wait - NoNewWindow
2228if ($LASTEXITCODE -ne 0 ) {
@@ -49,11 +55,7 @@ Write-Host ""
4955Set-Location ../ backend
5056
5157# Update venv path for backend directory
52- $venvPythonPath = " ../../.venv/Scripts/python.exe"
53- if (Test-Path - Path " /usr" ) {
54- # fallback to Linux venv path
55- $venvPythonPath = " ../../.venv/bin/python"
56- }
58+ $venvPythonPath = Get-VenvPythonPath " ../../.venv"
5759
5860$port = 50505
5961$hostname = " localhost"
0 commit comments