NUNA_FORK/setup.ps1

63 lines
2.3 KiB
PowerShell
Raw Permalink Normal View History

2026-02-03 06:17:08 +00:00
Write-Host "========================================" -ForegroundColor Cyan
Write-Host "NUNA Repository Setup" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
Write-Host ""
# Check Python
Write-Host "Checking Python installation..." -ForegroundColor Yellow
$pythonVersion = python --version 2>&1
if ($LASTEXITCODE -ne 0) {
Write-Host "ERROR: Python is not installed or not in PATH" -ForegroundColor Red
exit 1
}
Write-Host "Found: $pythonVersion" -ForegroundColor Green
Write-Host ""
# Create virtual environment
Write-Host "Creating virtual environment..." -ForegroundColor Yellow
if (Test-Path ".venv") {
Write-Host "Virtual environment already exists" -ForegroundColor Yellow
} else {
python -m venv .venv
if ($LASTEXITCODE -ne 0) {
Write-Host "ERROR: Failed to create virtual environment" -ForegroundColor Red
exit 1
}
Write-Host "Virtual environment created!" -ForegroundColor Green
}
Write-Host ""
# Activate virtual environment
Write-Host "Activating virtual environment..." -ForegroundColor Yellow
& .\.venv\Scripts\Activate.ps1
Write-Host ""
# Upgrade pip
Write-Host "Upgrading pip..." -ForegroundColor Yellow
python -m pip install --upgrade pip --quiet
Write-Host ""
# Install requirements
Write-Host "Installing requirements..." -ForegroundColor Yellow
python -m pip install -r requirements.txt
if ($LASTEXITCODE -ne 0) {
Write-Host "ERROR: Failed to install requirements" -ForegroundColor Red
exit 1
}
Write-Host ""
# Verify installation
Write-Host "Verifying installation..." -ForegroundColor Yellow
python -c "import google.auth; import msal; import requests; print('All packages imported successfully!')"
if ($LASTEXITCODE -eq 0) {
Write-Host ""
Write-Host "========================================" -ForegroundColor Green
Write-Host "Setup completed successfully!" -ForegroundColor Green
Write-Host "========================================" -ForegroundColor Green
Write-Host ""
Write-Host "To activate the virtual environment in the future, run:" -ForegroundColor Cyan
Write-Host " .\.venv\Scripts\Activate.ps1" -ForegroundColor White
Write-Host ""
} else {
Write-Host "WARNING: Some packages may not be installed correctly" -ForegroundColor Yellow
}