From 033821132ef012bb2072464e230d0617e274c142 Mon Sep 17 00:00:00 2001 From: janiceshi <297289441@qq.com> Date: Wed, 3 Apr 2024 13:18:25 +0800 Subject: [PATCH] =?UTF-8?q?fix():=20=E8=81=94=E5=90=88na=E4=B9=9F=E8=A6=81?= =?UTF-8?q?=E5=8A=A0current=E8=BD=AF=E8=BF=9E=E6=8E=A5=EF=BC=8C=20?= =?UTF-8?q?=E6=9C=89=E6=97=B6url=E8=AE=BF=E9=97=AE=E6=97=B6=E4=B8=8D?= =?UTF-8?q?=E5=AE=B9=E6=98=93=E7=9F=A5=E9=81=93=E5=BD=93=E5=89=8D=E7=89=88?= =?UTF-8?q?=E6=9C=AC=E6=98=AF=E5=A4=9A=E5=B0=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ref: DATA_PLATFORM-809 --- .../link_union_app_static_file.py | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/packages/brick-container/tools/package-union/link_union_app_static_file.py b/packages/brick-container/tools/package-union/link_union_app_static_file.py index b2a4d8f863..3ba2605bc8 100644 --- a/packages/brick-container/tools/package-union/link_union_app_static_file.py +++ b/packages/brick-container/tools/package-union/link_union_app_static_file.py @@ -152,6 +152,22 @@ def read_union_apps_file(install_app_path): return json.load(f) +def check_symlink_exists(symlink_path): + if os.path.islink(symlink_path): + return True + else: + return False + + +def create_current_link_to_app(target_path, symlink_path): + if check_symlink_exists(symlink_path): + os.remove(symlink_path) + try: + os.symlink(target_path, symlink_path) + except OSError as e: + raise RuntimeError("link file err: {}..".format(e)) + + def link_install_app_static_file(install_app_path): # 读取union-apps.json文件 union_apps = read_union_apps_file(install_app_path) @@ -171,6 +187,11 @@ def link_install_app_static_file(install_app_path): if not os.path.exists(current_app_path_public): os.makedirs(current_app_path_public) + link_file_path = os.path.join(_DEPENDENCIES_LOCK_BASE_PATH, _MICRO_APPS_FOLDER, + subdir_snippet, app_id, "current") + create_current_link_to_app(current_app_path_public, link_file_path) + + ### app的版本号加上current软链 print u"current app path: {}, current_app_path_public: {}".format(current_app_path, current_app_path_public)