fix: 修正 pyarmor_runtime 目录位置到 scripts 内部
- 修改 build.py 中混淆后文件移动逻辑,先移动 scripts 目录,再将 pyarmor_runtime 移动到 scripts 内部 - 更新 spec.md 中关于混淆后文件结构的描述 - 更新 config.yaml 中测试规范,强调严禁跳过测试 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
18
build.py
18
build.py
@@ -263,16 +263,32 @@ def obfuscate_scripts_dir(source_dir: str, target_dir: str) -> None:
|
||||
sys.exit(1)
|
||||
|
||||
# 移动混淆后的文件到最终位置
|
||||
scripts_dst_dir = os.path.join(target_dir, "scripts")
|
||||
pyarmor_runtime_dir = None
|
||||
|
||||
# 先移动 scripts 目录
|
||||
for item in os.listdir(temp_dir):
|
||||
src = os.path.join(temp_dir, item)
|
||||
if item == "scripts":
|
||||
dst = os.path.join(target_dir, item)
|
||||
|
||||
if os.path.exists(dst):
|
||||
if os.path.isdir(dst):
|
||||
shutil.rmtree(dst)
|
||||
else:
|
||||
os.remove(dst)
|
||||
shutil.move(src, dst)
|
||||
elif item.startswith("pyarmor_runtime"):
|
||||
pyarmor_runtime_dir = item
|
||||
|
||||
# 再移动 pyarmor_runtime 到 scripts 内部
|
||||
if pyarmor_runtime_dir:
|
||||
src = os.path.join(temp_dir, pyarmor_runtime_dir)
|
||||
dst = os.path.join(scripts_dst_dir, pyarmor_runtime_dir)
|
||||
if os.path.exists(dst):
|
||||
if os.path.isdir(dst):
|
||||
shutil.rmtree(dst)
|
||||
else:
|
||||
os.remove(dst)
|
||||
shutil.move(src, dst)
|
||||
|
||||
# 清理临时目录
|
||||
|
||||
@@ -8,7 +8,7 @@ context: |
|
||||
- 主机环境: 禁止污染配置,需操作须请求用户
|
||||
- 开发文档: README.md,每次迭代按需更新开发文档; 禁emoji/特殊字符
|
||||
- skill文档: SKILL.md,每次迭代按需更新skill文档
|
||||
- 测试: 所有需求必须设计全面测试
|
||||
- 测试: 所有需求必须设计全面测试,严禁跳过测试,无法进行的测试交用户决策
|
||||
- 任务: 除非用户直接要求,禁止创建git变更任务(push/commit等); git读取允许(status/log/diff等)
|
||||
- 代码: 模块文件150-300行; 错误需自定义异常+清晰信息+位置上下文
|
||||
- 项目阶段: 未上线,无用户,破坏性变更无需迁移说明
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
- **THEN** 系统不需要 --obfuscate 参数,直接执行混淆构建
|
||||
|
||||
### Requirement: PyArmor 混淆执行
|
||||
系统 SHALL 调用 PyArmor 工具对 scripts 目录进行混淆。
|
||||
系统 SHALL 调用 PyArmor 工具对 scripts 目录进行混淆,然后将 pyarmor_runtime 目录移动到 scripts 内部。
|
||||
|
||||
#### Scenario: PyArmor 成功执行
|
||||
- **WHEN** PyArmor 可用
|
||||
@@ -78,7 +78,7 @@
|
||||
|
||||
#### Scenario: 混淆后文件输出
|
||||
- **WHEN** PyArmor 混淆完成
|
||||
- **THEN** build/ 目录包含混淆后的文件和 pyarmor_runtime 子目录
|
||||
- **THEN** build/ 目录包含混淆后的 scripts 目录,且 pyarmor_runtime 子目录位于 scripts/ 内部
|
||||
|
||||
### Requirement: PyArmor 未安装友好提示
|
||||
系统 SHALL 在 PyArmor 未安装时提供清晰的错误提示,引导用户正确使用 `uv run --with pyarmor`。
|
||||
|
||||
Reference in New Issue
Block a user