| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| $ErrorActionPreference = "Stop" |
| $ver = (& python -m PyInstaller --version).Trim() |
| $inst = (& python -c "import PyInstaller,os;print(os.path.join(os.path.dirname(PyInstaller.__file__),'bootloader','Windows-64bit-intel'))").Trim() |
| $work = Join-Path $env:TEMP "openhop-bootloader-$ver" |
| New-Item -ItemType Directory -Force $work | Out-Null |
| |
| |
| $meta = Invoke-RestMethod "https://pypi.org/pypi/pyinstaller/$ver/json" |
| $sdist = $meta.urls | Where-Object packagetype -eq "sdist" | Select-Object -First 1 |
| $tgz = Join-Path $work $sdist.filename |
| if (-not (Test-Path $tgz)) { Invoke-WebRequest $sdist.url -OutFile $tgz } |
| if ((Get-FileHash $tgz -Algorithm SHA256).Hash.ToLower() -ne $sdist.digests.sha256) { throw "Downloaded source doesn't match PyPI's hash" } |
| tar -xzf $tgz -C $work 2>$null |
| $src = Join-Path $work "pyinstaller-$ver\bootloader" |
| if (-not (Test-Path (Join-Path $src "wscript"))) { throw "Bootloader source not found in $src" } |
| |
| |
| Push-Location $src |
| try { & python ./waf all --target-arch=64bit | Select-Object -Last 3 } finally { Pop-Location } |
| $built = Join-Path $work "pyinstaller-$ver\PyInstaller\bootloader\Windows-64bit-intel" |
| |
| |
| foreach ($f in "run.exe", "runw.exe", "run_d.exe", "runw_d.exe") { |
| $dst = Join-Path $inst $f |
| if (-not (Test-Path "$dst.stock")) { Copy-Item $dst "$dst.stock" } |
| Copy-Item (Join-Path $built $f) $dst -Force |
| } |
| "PyInstaller $ver, compiled $(Get-Date -Format s)" | Set-Content (Join-Path $inst "openhop-custom.txt") |
| Write-Host "Custom bootloader installed in $inst" |