From 123c21fcb3e5178aa897c0d842a0ccbb40dcc8ea Mon Sep 17 00:00:00 2001 From: Soulter <905617992@qq.com> Date: Thu, 5 Oct 2023 22:34:26 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E9=87=8D=E8=BD=BD=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E6=9B=B4=E6=96=B0=E4=BE=9D=E8=B5=96=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- model/command/command.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/model/command/command.py b/model/command/command.py index 2cf0ead11..88196092c 100644 --- a/model/command/command.py +++ b/model/command/command.py @@ -255,6 +255,16 @@ class Command: elif l[1] == "reload": if role != "admin": return False, f"你的身份组{role}没有权限重载插件", "plugin" + for plugin in cached_plugins: + try: + print(f"更新插件 {plugin} 依赖...") + plugin_path = os.path.join(ppath, cached_plugins[plugin]["root_dir_name"]) + if os.path.exists(os.path.join(plugin_path, "requirements.txt")): + mm = pipmain(['install', '-r', os.path.join(plugin_path, "requirements.txt"), "--quiet"]) + if mm != 0: + return False, "插件依赖安装失败,需要您手动pip安装对应插件的依赖。", "plugin" + except BaseException as e: + print(f"插件{plugin}依赖安装失败,原因: {str(e)}") try: ok, err = self.plugin_reload(cached_plugins, all = True) if ok: