From 4f0b9bdc190c99e98e8f6a8c197f118a695cfaf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=B2=D1=82=D0=BE=D0=BC=D0=B0=D1=82=D0=B0=20=D0=9A?= =?UTF-8?q?=D0=B0=D0=BB=D0=B0=D1=88=D0=BD=D0=B8=D0=BA=D0=BE=D0=B2=D0=B0?= <3056129056@qq.com> Date: Fri, 27 Nov 2026 18:09:36 +0800 Subject: [PATCH] =?UTF-8?q?tools:=20=E7=BC=BA=20lupa=20=E6=97=B6=E7=BB=99?= =?UTF-8?q?=E5=87=BA=E5=AE=89=E8=A3=85=E6=8F=90=E7=A4=BA=E8=80=8C=E4=B8=8D?= =?UTF-8?q?=E6=98=AF=20traceback?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 部署/开发机未装 lupa 时,脚本直接退出码 2 并提示 pip install lupa;宿主运行时自带该依赖,此处仅影响校验环境。 --- tools/verify_plugins.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tools/verify_plugins.py b/tools/verify_plugins.py index 530d376..a5ddbb6 100755 --- a/tools/verify_plugins.py +++ b/tools/verify_plugins.py @@ -22,7 +22,17 @@ import urllib.request ROOT = pathlib.Path(__file__).resolve().parents[1] sys.path.insert(0, str(ROOT)) -from lua.worker import LuaPlugin # noqa: E402 +try: + from lua.worker import LuaPlugin # noqa: E402 +except ImportError as exc: # pragma: no cover - 依赖缺失时的友好提示 + if "lupa" in str(exc): + sys.stderr.write( + "缺少 lupa:本脚本需要用它加载 Lua 插件。\n" + " pip install lupa\n" + "(宿主运行时自带 lupa,这里缺的是开发机上的校验环境)\n" + ) + raise SystemExit(2) + raise LIMITS = { "lua_memory_bytes": 268435456,