docs: codify free PyArmor Trial packaging guidance
All checks were successful
技能自动化发布 / release (push) Successful in 14s

This commit is contained in:
2026-10-13 15:55:44 +08:00
parent 1e2f94dd10
commit de127d7e71
8 changed files with 45 additions and 9 deletions

View File

@@ -1,5 +1,5 @@
# -*- coding: utf-8 -*-
"""发布打包守护:PyArmor 单文件行数与 UTF-8 without BOM。"""
"""发布打包守护:PyArmor Trial 约定、单文件行数与 UTF-8 without BOM。"""
from __future__ import annotations
import os
@@ -89,6 +89,26 @@ def _iter_scripts_py_files(skill_root: str) -> list[str]:
class TestReleasePackagingConstraints(unittest.TestCase):
def test_trial_packaging_guidance_is_documented(self) -> None:
skill_root = get_skill_root()
runtime_path = os.path.join(skill_root, "development", "RUNTIME.md")
development_path = os.path.join(skill_root, "development", "DEVELOPMENT.md")
with open(runtime_path, encoding="utf-8") as f:
runtime = f.read()
with open(development_path, encoding="utf-8") as f:
development = f.read()
required_guidance = {
"free/trial mode": (runtime + development, "Trial"),
"line limit is not sufficient": (runtime + development, "不是 Trial 加密成功的充分条件"),
"split the failing module by responsibility": (runtime + development, "按职责"),
"preserve compatibility imports": (runtime + development, "兼容门面"),
"verify real release encryption": (runtime + development, "实际加密"),
"inspect Gitea release result": (runtime + development, "Gitea"),
}
missing = [label for label, (text, needle) in required_guidance.items() if needle not in text]
self.assertEqual(missing, [], msg=f"Missing PyArmor Trial guidance: {missing}")
def test_scripts_py_files_under_pyarmor_line_limit(self) -> None:
skill_root = get_skill_root()
offenders: list[str] = []
@@ -104,8 +124,9 @@ class TestReleasePackagingConstraints(unittest.TestCase):
offenders,
[],
msg=(
"PyArmor trial/free mode may fail when a single Python file reaches "
f"{SCRIPTS_MAX_LINES} lines; split this file into smaller modules. "
"PyArmor trial/free mode has a preventive single-file line guard; "
"passing it does not guarantee Trial encryption succeeds. Split any "
"module identified by the actual Trial release error. "
f"Recommended keep each file < {SCRIPTS_RECOMMENDED_MAX_LINES} lines. "
f"Offenders: {offenders}"
),