pack.bat 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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 app_guanlang_v<version>.zip, written next to the install dir.
  24. rem (version rule + package name single source: src/version.py -> RULE / PACKAGE_STEM)
  25. rem Details: README at install root, section "PACK / packaging" (Chinese)
  26. rem and docs\??????.md section 9 (delivery package)
  27. rem ============================================================================
  28. chcp 65001 >nul
  29. set PYTHONUTF8=1
  30. cd /d "%~dp0"
  31. if not exist ".venv\Scripts\python.exe" (
  32. echo [X] Not installed yet: .venv\Scripts\python.exe not found
  33. echo Run install.bat first.
  34. pause
  35. exit /b 2
  36. )
  37. if /i "%~1"=="help" goto help
  38. if /i "%~1"=="dry" goto dry
  39. if /i "%~1"=="-n" goto dry
  40. if /i "%~1"=="verify" goto verify
  41. echo [i] Building the delivery package (no data / no products / no logs / no temp) ...
  42. ".venv\Scripts\python.exe" scripts\pack_dist.py %*
  43. set RC=%ERRORLEVEL%
  44. echo.
  45. if not "%RC%"=="0" (
  46. echo [X] Packaging failed, exit code %RC%. See the output above.
  47. ) else (
  48. echo [i] Done. Copy the .zip printed above to the target machine, then run
  49. echo install.bat there, then check.bat, then start.bat.
  50. )
  51. pause
  52. exit /b %RC%
  53. :dry
  54. echo [i] Dry run - showing what would be packed, nothing is written.
  55. ".venv\Scripts\python.exe" scripts\pack_dist.py --dry-run
  56. pause
  57. exit /b 0
  58. :verify
  59. if "%~2"=="" (
  60. echo [i] Usage: pack.bat verify [path\to\package.zip]
  61. echo With no path, the newest app_guanlang_v*.zip next to the install dir is used.
  62. )
  63. ".venv\Scripts\python.exe" scripts\pack_verify_entry.py %2
  64. pause
  65. exit /b 0
  66. :help
  67. echo Usage:
  68. echo pack.bat build the delivery package (zip)
  69. echo pack.bat dry show what would be packed, write nothing
  70. echo pack.bat verify [zip] open-box verify: extract + offline install + page probe
  71. echo pack.bat help this text
  72. echo Excluded by default: input data (data\), products (outputs\), logs (logs\, run\,
  73. echo any *.log/*.jsonl), temp files (caches, *.tmp, *.bak*, *~, ~$*, .DS_Store ...).
  74. echo See README at the install root, section PACK.
  75. exit /b 0