Spaces:
Running
Running
File size: 1,375 Bytes
c349d51 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | # Genera el .zip transportable: instalador + wheel + huellas.
param([string]$Salida = "runtime")
$ErrorActionPreference = "Stop"
$raiz = Split-Path -Parent (Split-Path -Parent $MyInvocation.MyCommand.Path)
$version = (Select-String -Path (Join-Path $raiz "pyproject.toml") -Pattern '^version = "(.+)"').Matches[0].Groups[1].Value
$bundle = Join-Path $raiz "$Salida\windows-bundle"
Remove-Item -LiteralPath $bundle -Recurse -Force -ErrorAction SilentlyContinue
New-Item -ItemType Directory -Path (Join-Path $bundle "payload") -Force | Out-Null
Push-Location $raiz
python -m pip install --quiet build
python -m build --wheel --outdir (Join-Path $raiz "dist")
Pop-Location
$wheel = Get-ChildItem (Join-Path $raiz "dist") -Filter "lexia-$version-*.whl" |
Sort-Object LastWriteTime -Descending | Select-Object -First 1
Copy-Item $wheel.FullName (Join-Path $bundle "payload")
Copy-Item (Join-Path $raiz "installer\*") $bundle
Get-ChildItem -LiteralPath (Join-Path $bundle "payload") -File | ForEach-Object {
"$((Get-FileHash $_.FullName -Algorithm SHA256).Hash.ToLower()) $($_.Name)"
} | Set-Content (Join-Path $bundle "SHA256SUMS.txt")
$zip = Join-Path $raiz "$Salida\LexIA-Windows-$version.zip"
Remove-Item -LiteralPath $zip -Force -ErrorAction SilentlyContinue
Compress-Archive -Path (Join-Path $bundle "*") -DestinationPath $zip
Write-Host "Paquete listo: $zip"
|