mothercup/tools/make_release.ps1
evan.liu 57762e50be tools: self-contained portable production package
- tools/python-embed/: embedded Python 3.12.10 runtime with bleak/pyserial
  preinstalled (git-ignored, fetched from the huaweicloud mirror); bats
  resolve Python in order: python-embed -> .venv-ble -> system
- NSpyocd.exe + DFP pack copied into tools/ (git-ignored);
  flash_package.py prefers the in-tools copies
- make_release.bat/ps1: one-click zip to out/mothercup_tools_<ts>.zip
  (staged in TEMP to avoid self-inclusion; zip excluded from git)
- all bats converted to CRLF (LF-only breaks cmd block parsing and %~dp0)
- verified: zip extracted outside the repo runs ble_ota --uart end-to-end
  (PASS, 27 kB/s) and flash_package via the bundled NSpyocd
- docs: dev log section 49, AGENTS.md tools section + heap 18KB fix
2026-09-05 10:34:59 +08:00

15 lines
920 B
PowerShell

# make_release.ps1 - pack tools/ into a self-contained production zip.
# The zip holds the embedded Python runtime (python-embed/, bleak+pyserial
# preinstalled) and NSpyocd, so the target PC needs NO installation.
# Excludes the dev-only venv and caches; keeps out/ (the firmware images).
# NOTE: the zip is staged in $TEMP first - writing it into out/ while
# reading out/ would make Compress-Archive read its own half-written file.
$tools = Split-Path -Parent $MyInvocation.MyCommand.Path
$stamp = Get-Date -Format "yyyyMMdd_HHmm"
$stage = Join-Path $env:TEMP "mothercup_tools_$stamp.zip"
$final = Join-Path $tools "out\mothercup_tools_$stamp.zip"
$items = Get-ChildItem $tools | Where-Object { $_.Name -notin @('.venv-ble', '__pycache__') }
Compress-Archive -Path ($items | ForEach-Object { $_.FullName }) -DestinationPath $stage -Force -ErrorAction Stop
Move-Item $stage $final -Force
Write-Output "packed: $final"