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:
2026-03-15 12:42:08 +08:00
parent edbdeec90d
commit 78063b9e07
3 changed files with 21 additions and 5 deletions

View File

@@ -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)
dst = os.path.join(target_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)
# 清理临时目录