Files
ykxmz/_build/pack_include_ico.py
xmz7891 ce87ec1650 1.7.0:常规发布
- 版本号 1.7.0 -> 1.7.0
- 重建三端并打包
- 关键测试全过
2026-10-06 23:08:07 +08:00

53 lines
1.5 KiB
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# -*- coding: utf-8 -*-
r"""服务器端打包时带上 favicon.ico。
package_remote.py 原来只收 relay 目录下的 .py / .sh,
favicon.ico 会被漏掉 —— 结果装到新设备上管理页又没图标了。
"""
from __future__ import annotations
import ast
import sys
from pathlib import Path
PKG = (Path(r"C:\Users\shu\Desktop\deepseekagent\LanRemote\_build"
r"\package_remote.py"))
OLD = ''' wanted = sorted(
[f for f in RELAY_SRC.iterdir()
if f.suffix in (".py", ".sh") and f.is_file()],
key=lambda f: f.name)'''
NEW = ''' # 后缀白名单:.py / .sh 是服务本体,.ico 是管理页图标。
# 漏掉 .ico 的话,装到新设备上管理页又会变成没有图标的默认样式。
wanted = sorted(
[f for f in RELAY_SRC.iterdir()
if f.suffix in (".py", ".sh", ".ico") and f.is_file()],
key=lambda f: f.name)'''
def main() -> int:
text = PKG.read_text(encoding="utf-8")
if '.sh", ".ico"' in text:
print(" 已经改过")
return 0
if OLD not in text:
print(" [失败] 锚点没找到")
return 1
text = text.replace(OLD, NEW, 1)
PKG.write_text(text, encoding="utf-8", newline="\n")
print(" 服务器端打包现在会带上 .ico")
try:
ast.parse(text)
print(" 语法 OK")
except SyntaxError as exc:
print(f" 语法错误: 行 {exc.lineno}: {exc.msg}")
return 1
return 0
if __name__ == "__main__":
sys.exit(main())