diff --git a/.gitignore b/.gitignore index 8c6dce5..f808f7b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,19 @@ -.vs/ +# Python Byte-compiled / Optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# Compiled Release Files +Borealis-Agent.exe +Borealis-Server.exe + +# Pyinstaller Files +/Data/Agent/Packaging_Data/ +/Data/Server/Packaging_Data/ + +# Development Folders /Server/ /Agent/ -/Pyinstaller_Temp/ -/dist/ -Borealis-Agent.exe -/Data/Agent/Packaging_Data/ -Borealis-Server.exe -/Data/Server/Packaging_Data/ -borealis_directory_structure.txt \ No newline at end of file + +# Misc Files/Folders +.vs/s \ No newline at end of file diff --git a/Data/Agent/Package_Borealis-Agent.ps1 b/Data/Agent/Package_Borealis-Agent.ps1 index 5cebec5..a3e7266 100644 --- a/Data/Agent/Package_Borealis-Agent.ps1 +++ b/Data/Agent/Package_Borealis-Agent.ps1 @@ -1,50 +1,68 @@ -#////////// PROJECT FILE SEPARATION LINE ////////// CODE AFTER THIS LINE ARE FROM: /Agent/Package_Borealis-Agent.ps1 +#////////// PROJECT FILE SEPARATION LINE ////////// CODE AFTER THIS LINE ARE FROM: /Data/Agent/Package_Borealis-Agent.ps1 # Configuration -$packagingDir = "Packaging_Data" -$venvDir = "$packagingDir\Pyinstaller_Virtual_Environment" -$distDir = "$packagingDir\dist" -$buildDir = "$packagingDir\build" -$specPath = "$packagingDir" -$agentScript = "borealis-agent.py" -$outputName = "Borealis-Agent" -$finalExeName = "$outputName.exe" +$packagingDir = "Packaging_Data" +$venvDir = "$packagingDir\Pyinstaller_Virtual_Environment" +$distDir = "$packagingDir\dist" +$buildDir = "$packagingDir\build" +$specPath = "$packagingDir" +$agentScript = "borealis-agent.py" +$outputName = "Borealis-Agent" +$finalExeName = "$outputName.exe" $requirementsPath = "requirements.txt" -$iconPath = "..\Borealis.ico" +$iconPath = "..\Borealis.ico" + +# figure out where everything lives +$scriptDir = Split-Path $MyInvocation.MyCommand.Definition -Parent +$projectRoot = Resolve-Path (Join-Path $scriptDir "..\..") +$embeddedPython = Join-Path $projectRoot 'Dependencies\Python\python.exe' # Ensure Packaging_Data directory exists if (-Not (Test-Path $packagingDir)) { New-Item -ItemType Directory -Path $packagingDir | Out-Null } -# Set up virtual environment -if (-Not (Test-Path "$venvDir\Scripts\Activate.ps1")) { - Write-Host "[SETUP] Creating virtual environment at $venvDir" - python -m venv $venvDir +# 1) Create or recreate virtual environment using the embedded Python +if (-Not (Test-Path "$venvDir\Scripts\python.exe")) { + Write-Host "[SETUP] Creating virtual environment at $venvDir using embedded Python" + & $embeddedPython -m venv --upgrade-deps $venvDir } -# Activate virtual environment -Write-Host "[INFO] Activating virtual environment" -. "$venvDir\Scripts\Activate.ps1" +# helper for calling into that venv +$venvPy = Join-Path $venvDir 'Scripts\python.exe' -# Install agent dependencies from requirements file +# 2) Bootstrap pip (in case ensurepip wasn’t automatic) and upgrade +Write-Host "[INFO] Ensuring pip is available in the venv" +& $venvPy -m ensurepip --upgrade + +Write-Host "[INFO] Upgrading pip" +& $venvPy -m pip install --upgrade pip + +# 3) Install your agent’s dependencies Write-Host "[INFO] Installing agent dependencies from $requirementsPath" -pip install --upgrade pip > $null -pip install -r $requirementsPath > $null +& $venvPy -m pip install -r $requirementsPath -# Install PyInstaller +# 4) Install PyInstaller into that same venv Write-Host "[INFO] Installing PyInstaller" -pip install pyinstaller > $null +& $venvPy -m pip install pyinstaller -# Clean previous build artifacts +# 5) Clean previous build artifacts Write-Host "[INFO] Cleaning previous build artifacts" Remove-Item -Recurse -Force $distDir, $buildDir, "$specPath\$outputName.spec" -ErrorAction SilentlyContinue -# Run PyInstaller to create single-file executable with custom icon +# 6) Run PyInstaller Write-Host "[INFO] Running PyInstaller with icon $iconPath" -pyinstaller --onefile --icon "$iconPath" --noconfirm --name $outputName --distpath $distDir --workpath $buildDir --specpath $specPath $agentScript +& $venvPy -m PyInstaller ` + --onefile ` + --icon "$iconPath" ` + --noconfirm ` + --name $outputName ` + --distpath $distDir ` + --workpath $buildDir ` + --specpath $specPath ` + $agentScript -# Copy resulting executable to Agent folder +# 7) Copy the final exe back into your Agent folder if (Test-Path "$distDir\$finalExeName") { Copy-Item "$distDir\$finalExeName" ".\$finalExeName" -Force Write-Host "[SUCCESS] Agent packaged at .\$finalExeName" diff --git a/Data/Server/Package-Borealis-Server.ps1 b/Data/Server/Package-Borealis-Server.ps1 index 757d64c..c00f5be 100644 --- a/Data/Server/Package-Borealis-Server.ps1 +++ b/Data/Server/Package-Borealis-Server.ps1 @@ -1,4 +1,4 @@ -#////////// PROJECT FILE SEPARATION LINE ////////// CODE AFTER THIS LINE ARE FROM: /Package-Borealis-Server.ps1 +#////////// PROJECT FILE SEPARATION LINE ////////// CODE AFTER THIS LINE ARE FROM: /Data/Server/Package-Borealis-Server.ps1 # ------------------- CONFIGURATION ------------------- $venvDir = "Pyinstaller_Virtual_Environment" diff --git a/Launch-Borealis.ps1 b/Launch-Borealis.ps1 index 7ca5d2c..8cbcb2a 100644 --- a/Launch-Borealis.ps1 +++ b/Launch-Borealis.ps1 @@ -152,7 +152,7 @@ switch ($choice) { <# Step: Build React App #> - Run-Step "ReactJS Web Frontend: Build App" { + Run-Step "ReactJS Web Frontend: " { Push-Location $webUIDestination & $npmCmd run build Pop-Location diff --git a/borealis_directory_structure.txt b/borealis_directory_structure.txt deleted file mode 100644 index c2d0191..0000000 Binary files a/borealis_directory_structure.txt and /dev/null differ