50 lines
1.6 KiB
PowerShell
50 lines
1.6 KiB
PowerShell
# Bootstrap Borealis Virtual Python Environment
|
|
# Run Script: "Set-ExecutionPolicy Unrestricted -Scope Process .\Start_Windows.ps1"
|
|
|
|
# Define paths
|
|
$venvPath = "Borealis-Workflow-Automation-Tool"
|
|
$dataSource = "Data"
|
|
$dataDestination = "$venvPath\Borealis"
|
|
|
|
# Check if virtual environment exists
|
|
if (!(Test-Path "$venvPath\Scripts\Activate")) {
|
|
Write-Output "Creating virtual environment '$venvPath'..."
|
|
python -m venv $venvPath
|
|
}
|
|
|
|
# Ensure the Data folder exists before copying
|
|
if (Test-Path $dataSource) {
|
|
Write-Output "Copying Data folder into virtual environment..."
|
|
|
|
# Remove old data if it exists
|
|
if (Test-Path $dataDestination) {
|
|
Remove-Item -Recurse -Force $dataDestination
|
|
}
|
|
|
|
# Create the Borealis directory inside the virtual environment
|
|
New-Item -Path $dataDestination -ItemType Directory -Force | Out-Null
|
|
|
|
# Copy Data into the virtual environment under Borealis
|
|
Copy-Item -Path "$dataSource\*" -Destination $dataDestination -Recurse
|
|
} else {
|
|
Write-Output "Warning: Data folder not found, skipping copy."
|
|
}
|
|
|
|
# Activate virtual environment
|
|
Write-Output "Activating virtual environment..."
|
|
. "$venvPath\Scripts\Activate"
|
|
|
|
# Install dependencies
|
|
if (Test-Path "requirements.txt") {
|
|
Write-Output "Installing dependencies..."
|
|
pip install -q -r requirements.txt
|
|
} else {
|
|
Write-Output "No requirements.txt found, skipping installation."
|
|
}
|
|
|
|
# Run the main script from inside the copied Data folder
|
|
Write-Output "Starting Borealis Workflow Automation Tool..."
|
|
python "$dataDestination\borealis.py"
|
|
|
|
# Deactivate after execution
|
|
deactivate |