pack.bat 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. @echo off
  2. rem ============================================================================
  3. rem Guanlan pack.bat - build the delivery package (zip).
  4. rem
  5. rem ASCII ONLY ON PURPOSE (see docs section 11.3): Chinese text in a .bat is
  6. rem codepage-dependent and cmd.exe has been seen to execute parts of it.
  7. rem
  8. rem What the package contains: program + configs + pages/assets + offline
  9. rem wheels + vendor runtime + delivery docs + the install/start/stop/pack
  10. rem scripts. What it does NOT contain (default, no flags needed):
  11. rem 1) input data data/ (field raw files)
  12. rem 2) products outputs/ (page data)
  13. rem 3) run logs logs/ run/ and any *.log / *.jsonl anywhere
  14. rem 4) temp files caches (*_cache, __pycache__), *.tmp *.bak* *.old
  15. rem *.orig *.rej *.swp *~ ~$* .DS_Store Thumbs.db
  16. rem
  17. rem Usage:
  18. rem pack.bat build the package (same as: python scripts\pack_dist.py)
  19. rem pack.bat dry show what would be packed, write nothing
  20. rem pack.bat verify open-box verify an already built zip
  21. rem pack.bat help this text
  22. rem
  23. rem Output: a .zip named guanlan-v[version]_dist_[date].zip, written next to the install dir.
  24. rem Details: README at install root, section "PACK / packaging" (Chinese)
  25. rem and docs\??????.md section 9 (delivery package)
  26. rem ============================================================================
  27. chcp 65001 >nul
  28. set PYTHONUTF8=1
  29. cd /d "%~dp0"
  30. if not exist ".venv\Scripts\python.exe" (
  31. echo [X] Not installed yet: .venv\Scripts\python.exe not found
  32. echo Run install.bat first.
  33. pause
  34. exit /b 2
  35. )
  36. if /i "%~1"=="help" goto help
  37. if /i "%~1"=="dry" goto dry
  38. if /i "%~1"=="-n" goto dry
  39. if /i "%~1"=="verify" goto verify
  40. echo [i] Building the delivery package (no data / no products / no logs / no temp) ...
  41. ".venv\Scripts\python.exe" scripts\pack_dist.py %*
  42. set RC=%ERRORLEVEL%
  43. echo.
  44. if not "%RC%"=="0" (
  45. echo [X] Packaging failed, exit code %RC%. See the output above.
  46. ) else (
  47. echo [i] Done. Copy the .zip printed above to the target machine, then run
  48. echo install.bat there, then check.bat, then start.bat.
  49. )
  50. pause
  51. exit /b %RC%
  52. :dry
  53. echo [i] Dry run - showing what would be packed, nothing is written.
  54. ".venv\Scripts\python.exe" scripts\pack_dist.py --dry-run
  55. pause
  56. exit /b 0
  57. :verify
  58. if "%~2"=="" (
  59. echo [i] Usage: pack.bat verify [path\to\package.zip]
  60. echo With no path, the newest guanlan-v*_dist_*.zip next to the install dir is used.
  61. )
  62. ".venv\Scripts\python.exe" scripts\pack_verify_entry.py %2
  63. pause
  64. exit /b 0
  65. :help
  66. echo Usage:
  67. echo pack.bat build the delivery package (zip)
  68. echo pack.bat dry show what would be packed, write nothing
  69. echo pack.bat verify [zip] open-box verify: extract + offline install + page probe
  70. echo pack.bat help this text
  71. echo Excluded by default: input data (data\), products (outputs\), logs (logs\, run\,
  72. echo any *.log/*.jsonl), temp files (caches, *.tmp, *.bak*, *~, ~$*, .DS_Store ...).
  73. echo See README at the install root, section PACK.
  74. exit /b 0