From 60a8f3090ec07ef61c7741dd525905662b08d22c Mon Sep 17 00:00:00 2001 From: jingrow Date: Wed, 29 Oct 2025 06:24:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=8A=E4=BC=A0=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E5=BA=94=E7=94=A8=E5=92=8C=E4=BB=8E=E6=96=87=E4=BB=B6?= =?UTF-8?q?URL=E5=AE=89=E8=A3=85=E5=BA=94=E7=94=A8=E5=A4=9A=E4=BA=86?= =?UTF-8?q?=E4=B8=80=E5=B1=82=E7=9B=AE=E5=BD=95=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/jingrow/jingrow/utils/app_installer.py | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/apps/jingrow/jingrow/utils/app_installer.py b/apps/jingrow/jingrow/utils/app_installer.py index c0faf63..373d894 100644 --- a/apps/jingrow/jingrow/utils/app_installer.py +++ b/apps/jingrow/jingrow/utils/app_installer.py @@ -80,23 +80,16 @@ def analyze_package(temp_dir: str) -> Dict[str, Any]: if not root_items: return {'success': False, 'error': '目录为空'} - # 对于 git clone 的目录,跳过 .git,检查是否为应用根目录 - # 统计非 .git 的目录数量 - non_git_dirs = [item for item in root_items if os.path.isdir(os.path.join(temp_dir, item)) and item != '.git'] - - # 检查是否包含 .git 目录(说明是 Git 仓库) - is_git_repo = '.git' in root_items + # 对于解压后的目录,判断应用层级 + # 统计非系统目录的目录数量 + non_git_dirs = [item for item in root_items if os.path.isdir(os.path.join(temp_dir, item)) and item not in ['.git', '__pycache__']] root_dir = temp_dir - # 如果只有一个目录且是 Git 仓库,通常是 Git 仓库克隆后的结构,需要进入 - # 如果有多个目录,说明已经是应用根目录 - if len(non_git_dirs) == 1 and is_git_repo: + # 如果只有一个目录,需要进入(解压后的标准结构) + if len(non_git_dirs) == 1: root_dir = os.path.join(temp_dir, non_git_dirs[0]) - # 如果多个目录但有 .git,说明 Git 仓库根目录就是应用根目录(典型开发结构) - elif len(non_git_dirs) > 1 and is_git_repo: - # 不进入子目录,直接使用 temp_dir 作为 root_dir - root_dir = temp_dir + # 如果有多个目录(demo/, frontend/ 等),说明已经是应用根目录,直接使用 package_info = { 'app_name': os.path.basename(root_dir),