From 670cd5eb1a9b620d47c1f3bcc3cf94a5b6741081 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wuyi=E6=97=A0=E7=96=91?= <444835641@qq.com> Date: Sat, 8 Jul 2023 22:34:27 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=E4=BF=AE=E5=A4=8D=E4=B8=80?= =?UTF-8?q?=E4=BA=9B=E6=8F=92=E4=BB=B6=E6=9B=B4=E6=96=B0=E5=92=8C=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gsuid_core/utils/plugins_update/_plugins.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gsuid_core/utils/plugins_update/_plugins.py b/gsuid_core/utils/plugins_update/_plugins.py index 1e8b7d2..e721ad6 100644 --- a/gsuid_core/utils/plugins_update/_plugins.py +++ b/gsuid_core/utils/plugins_update/_plugins.py @@ -16,7 +16,8 @@ plugins_list: Dict[str, Dict[str, str]] = {} async def update_all_plugins() -> List[str]: log_list = [] for plugin in PLUGINS_PATH.iterdir(): - log_list.extend(update_from_git(0, plugin)) + if plugin.is_dir(): + log_list.extend(update_from_git(0, plugin)) return log_list @@ -64,7 +65,12 @@ def install_plugins(plugins: Dict[str, str]) -> str: path = PLUGINS_PATH / plugin_name if path.exists(): return '该插件已经安装过了!' - Repo.clone_from(git_path, path, single_branch=True, depth=1) + config = {'single_branch': True, 'depth': 1} + + if plugins['branch'] != 'main': + config['branch'] = plugins['branch'] + + Repo.clone_from(git_path, path, **config) logger.info(f'插件{plugin_name}安装成功!') return f'插件{plugin_name}安装成功!发送[gs重启]以应用!'