73 lines
2.5 KiB
PowerShell
73 lines
2.5 KiB
PowerShell
# Script de build para PyInstaller
|
|
# Genera un ejecutable único de la aplicación
|
|
|
|
Write-Host "===============================================" -ForegroundColor Cyan
|
|
Write-Host "CloudRestoreAS - Build Script" -ForegroundColor Cyan
|
|
Write-Host "===============================================" -ForegroundColor Cyan
|
|
Write-Host ""
|
|
|
|
# Verificar que PyInstaller esté instalado
|
|
Write-Host "Verificando PyInstaller..." -ForegroundColor Yellow
|
|
$pyinstallerCheck = pip show pyinstaller 2>$null
|
|
if (-not $pyinstallerCheck) {
|
|
Write-Host "PyInstaller no está instalado. Instalando..." -ForegroundColor Yellow
|
|
pip install pyinstaller
|
|
}
|
|
|
|
# Crear directorio de build
|
|
$buildDir = "build"
|
|
$distDir = "dist"
|
|
|
|
Write-Host ""
|
|
Write-Host "Limpiando builds anteriores..." -ForegroundColor Yellow
|
|
if (Test-Path $buildDir) {
|
|
Remove-Item -Recurse -Force $buildDir
|
|
}
|
|
if (Test-Path $distDir) {
|
|
Remove-Item -Recurse -Force $distDir
|
|
}
|
|
if (Test-Path "*.spec") {
|
|
Remove-Item -Force *.spec
|
|
}
|
|
|
|
Write-Host ""
|
|
Write-Host "Ejecutando PyInstaller..." -ForegroundColor Yellow
|
|
Write-Host ""
|
|
|
|
# Ejecutar PyInstaller
|
|
pyinstaller --name CloudRestoreAS `
|
|
--onefile `
|
|
--windowed `
|
|
--icon=NONE `
|
|
--add-data "app;app" `
|
|
--hidden-import PySide6 `
|
|
--hidden-import pyodbc `
|
|
--hidden-import win32crypt `
|
|
--collect-all PySide6 `
|
|
runner.py
|
|
|
|
if ($LASTEXITCODE -eq 0) {
|
|
Write-Host ""
|
|
Write-Host "===============================================" -ForegroundColor Green
|
|
Write-Host "Build completado exitosamente!" -ForegroundColor Green
|
|
Write-Host "===============================================" -ForegroundColor Green
|
|
Write-Host ""
|
|
Write-Host "El ejecutable se encuentra en:" -ForegroundColor Cyan
|
|
Write-Host " $PWD\dist\CloudRestoreAS.exe" -ForegroundColor White
|
|
Write-Host ""
|
|
Write-Host "IMPORTANTE:" -ForegroundColor Yellow
|
|
Write-Host " - Copia las carpetas 'data' y 'logs' junto al .exe" -ForegroundColor White
|
|
Write-Host " - Asegúrate de tener 7-Zip instalado" -ForegroundColor White
|
|
Write-Host " - Asegúrate de tener ODBC Driver 17 for SQL Server" -ForegroundColor White
|
|
Write-Host ""
|
|
} else {
|
|
Write-Host ""
|
|
Write-Host "===============================================" -ForegroundColor Red
|
|
Write-Host "Error durante el build" -ForegroundColor Red
|
|
Write-Host "===============================================" -ForegroundColor Red
|
|
Write-Host ""
|
|
}
|
|
|
|
# Pausar para ver resultados
|
|
Read-Host "Presiona Enter para continuar..."
|