- src/ 人写代码:main.py(Fluent 界面、Light/Dark/dark1/dark2/跟随系统主题、 关于按钮;主题三件套 = setTheme + QPalette/应用级 QSS + DWM 标题栏, 修复 Light 下窗口背景/页签/标题栏仍为系统深色的问题)、edid.py (EDID/CTA/HDMI/HDR 解析)、windows_edid.py(WMI 只读)、theme.py、 test_edid.py(9 项解析测试,含随机畸形数据无崩溃检查) - assets/ 图标与生成脚本;release/ 交付:EDID-Viewer.exe(onefile 63.7MB, 启动/图标/主题已验证)+ README,与 DLPilot/release 同约定 exe 直接入库 - 流水线对齐 DLPilot:src/build_exe.py(spec 由脚本生成不入库,剔除 PATH 上 Poppler/Conda 版本化 ICU,避免 QtCore 报 WinError 127)→ package_release.py(组装 EDID-Viewer-v*-win64.zip,zip 只上传 Gitea)→ publish_gitea.py(token 走 GITEA_TOKEN,自签证书 --insecure) - agent.md 更名 AGENTS.md(DLPilot 双文档约定:README 给人 / AGENTS.md 给 Agent);根 .gitignore 增加 EDID-viewer/release/*.zip - validation/ 保留 EDID 本机/合成样本与窗口截图、关于对话框自检脚本
62 lines
2.3 KiB
Python
62 lines
2.3 KiB
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
"""
|
|
组装 EDID-Viewer 发布包: exe + README → 一个 zip(解压即用)
|
|
================================================
|
|
把主 README 复制进 release/ 后, 与单文件 exe 一起压成 zip —— 两者内容一致。
|
|
|
|
zip 解压后根目录为 EDID-Viewer/:
|
|
EDID-Viewer.exe 主程序(先运行 build_exe.py 打包)
|
|
README.md 使用说明
|
|
|
|
用法:
|
|
python package_release.py 版本号自动取最近 git tag(EDID-Viewer-v*)
|
|
python package_release.py 0.1.0 手动指定版本号
|
|
产物: release/EDID-Viewer-v<版本>-win64.zip(zip 不入库, 上传到 Gitea Release)
|
|
"""
|
|
|
|
import os
|
|
import shutil
|
|
import subprocess
|
|
import sys
|
|
import zipfile
|
|
|
|
SRC = os.path.dirname(os.path.abspath(__file__))
|
|
BASE = os.path.dirname(SRC)
|
|
RELEASE = os.path.join(BASE, 'release')
|
|
|
|
|
|
def detect_version():
|
|
"""从最近的 EDID-Viewer-v* tag 推断版本号, 无 tag 则报错提示手动指定"""
|
|
try:
|
|
out = subprocess.check_output(
|
|
['git', 'describe', '--tags', '--abbrev=0', '--match', 'EDID-Viewer-v*'],
|
|
cwd=BASE, stderr=subprocess.DEVNULL)
|
|
return out.decode().strip().removeprefix('EDID-Viewer-v')
|
|
except Exception:
|
|
sys.exit('未能从 git tag 推断版本号, 请手动指定: python package_release.py <版本号>')
|
|
|
|
|
|
def main():
|
|
version = (sys.argv[1] if len(sys.argv) > 1 else detect_version()).lstrip('v')
|
|
exe = os.path.join(RELEASE, 'EDID-Viewer.exe')
|
|
readme = os.path.join(BASE, 'README.md')
|
|
if not os.path.exists(exe):
|
|
sys.exit('缺少 release/EDID-Viewer.exe, 先运行: python build_exe.py')
|
|
if not os.path.exists(readme):
|
|
sys.exit(f'缺少 {readme}')
|
|
|
|
shutil.copy2(readme, os.path.join(RELEASE, 'README.md'))
|
|
zip_name = f'EDID-Viewer-v{version}-win64.zip'
|
|
zip_path = os.path.join(RELEASE, zip_name)
|
|
with zipfile.ZipFile(zip_path, 'w', zipfile.ZIP_DEFLATED) as z:
|
|
z.write(exe, f'EDID-Viewer/{os.path.basename(exe)}')
|
|
z.write(os.path.join(RELEASE, 'README.md'), 'EDID-Viewer/README.md')
|
|
print(f'发布文件夹: {RELEASE} (exe + README)')
|
|
print(f'发布包: {zip_path} ({os.path.getsize(zip_path) / 1024 / 1024:.1f} MB)')
|
|
print('下一步上传: python publish_gitea.py', zip_name)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|