- 新增 XQ0042 抖音平台核对、XQ0041 新美大平台核对插件的 UI 源码与打包脚本 - 重构续签电子签、服务岗转正不通过电子签等插件的版本与配置 - 删除旧版考勤异常处理、微盟数据导出等冗余插件文件 - 修复出勤积分更新插件的 OPM 推送判断逻辑 - 优化壳子插件页面的 iframe 滚动条样式
37 lines
1.3 KiB
Python
37 lines
1.3 KiB
Python
# -*- coding: utf-8 -*-
|
||
"""发布打包辅助(开发工具,`_` 前缀运行时不会被插件扫描加载)。
|
||
|
||
输出 dist-plugin/xq0042_v<版本>.zip,zip 根含 plugin.json。
|
||
排除:ui-src、__pycache__、debug、.sessions、本脚本、*.pyc。
|
||
|
||
用法(仓库根下执行):
|
||
.venv\\Scripts\\python.exe "plugins\\XQ0001-0100\\XQ0042 抖音平台核对\\_pack.py"
|
||
"""
|
||
import json
|
||
import zipfile
|
||
from pathlib import Path
|
||
|
||
_HERE = Path(__file__).resolve().parent
|
||
_OUT_DIR = _HERE.parents[2] / "dist-plugin"
|
||
_EXCLUDE_DIRS = {"ui-src", "__pycache__", "debug", ".sessions"}
|
||
_EXCLUDE_FILES = {"_pack.py"}
|
||
|
||
|
||
def main():
|
||
manifest = json.loads((_HERE / "plugin.json").read_text(encoding="utf-8"))
|
||
pid, ver = manifest["id"], manifest["version"]
|
||
_OUT_DIR.mkdir(exist_ok=True)
|
||
out = _OUT_DIR / f"{pid}_v{ver}.zip"
|
||
with zipfile.ZipFile(out, "w", zipfile.ZIP_DEFLATED) as zf:
|
||
for p in sorted(_HERE.rglob("*")):
|
||
rel = p.relative_to(_HERE)
|
||
if set(rel.parts) & _EXCLUDE_DIRS or p.name in _EXCLUDE_FILES or p.suffix == ".pyc":
|
||
continue
|
||
if p.is_file():
|
||
zf.write(p, str(rel))
|
||
print(f"已打包: {out}({out.stat().st_size / 1024:.0f} KB)")
|
||
|
||
|
||
if __name__ == "__main__":
|
||
main()
|