From 02e220b57f6afe120c095263f644f0c78457286d Mon Sep 17 00:00:00 2001 From: bensonhome <410554565@qq.com> Date: Tue, 9 Jul 2024 16:57:04 +0800 Subject: [PATCH 1/2] =?UTF-8?q?:bug:=E5=A2=9E=E5=8A=A0=E5=BC=82=E5=B8=B8?= =?UTF-8?q?=E5=A4=84=E7=90=86=E9=80=BB=E8=BE=91=EF=BC=8C=E9=81=BF=E5=85=8D?= =?UTF-8?q?=E6=9C=AA=E6=81=A2=E5=A4=8D=E5=BD=93=E5=89=8D=E5=B7=A5=E4=BD=9C?= =?UTF-8?q?=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/util/zipmgr.py | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/client/util/zipmgr.py b/client/util/zipmgr.py index f49a7c45f..0344d1f71 100644 --- a/client/util/zipmgr.py +++ b/client/util/zipmgr.py @@ -119,14 +119,24 @@ def decompress_by_7z(self, zip_file, path, print_enable=False): def decompress(self, zip_file, path): logger.info("zip模块执行解压操作...") # 20190927 bug-fixed, 防止在当前目录下删除当前目录,出现权限异常情况 - os.chdir("..") - if os.path.exists(path): - PathMgr().rmpath(path) + cur_dir = os.getcwd() + cur_dir_is_changed = False + if PathMgr().format_path(cur_dir) == PathMgr().format_path(path): + logger.info("Decompress dir is current dir, can not delete it directory, change to parent directory first.") + # 如果要删除的是当前工作目录,先切换到上层目录,再删除 + os.chdir("..") + cur_dir_is_changed = True - self.decompress_by_7z(zip_file, path, print_enable=True) - - if os.path.exists(WORK_DIR): - os.chdir(WORK_DIR) + try: + if os.path.exists(path): + PathMgr().rmpath(path) + + self.decompress_by_7z(zip_file, path, print_enable=True) + finally: + # 恢复进入到当前工作目录 + logger.info("Go back to the current working directory.") + if cur_dir_is_changed and os.path.exists(cur_dir): + os.chdir(cur_dir) return True def subprocc_log(self, line): From 8ba50b4dd134baa41fbd479a4ed5a0e67b10bf23 Mon Sep 17 00:00:00 2001 From: bensonhome <410554565@qq.com> Date: Tue, 16 Jul 2024 17:18:59 +0800 Subject: [PATCH 2/2] =?UTF-8?q?:art:=E5=A2=9E=E5=8A=A0=E5=AE=A2=E6=88=B7?= =?UTF-8?q?=E7=AB=AF=E7=89=88=E6=9C=AC=E8=BE=93=E5=87=BA=EF=BC=9B=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E7=89=88=E6=9C=AC=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/codepuppy.py | 8 ++++++++ client/settings/edition.py | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/client/codepuppy.py b/client/codepuppy.py index c9794e111..faf84bc91 100644 --- a/client/codepuppy.py +++ b/client/codepuppy.py @@ -37,6 +37,8 @@ def __init__(self): self._params = CmdArgParser.parse_args() # 日志输出设置 self.__setup_logger() + # 打印版本信息 + self.__print_client_version() if getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'): LogPrinter.info('running in a PyInstaller bundle') @@ -49,6 +51,12 @@ def __init__(self): # 默认git配置 GitConfig.set_default_config() + def __print_client_version(self): + """打印TCA客户端版本信息""" + LogPrinter.info("=" * 39) + LogPrinter.info(f"*** TCA Client v{settings.VERSION}({settings.EDITION.name} Beta) ***") + LogPrinter.info("=" * 39) + def __setup_logger(self): """日志打印配置 diff --git a/client/settings/edition.py b/client/settings/edition.py index df9932339..5f6a81f6e 100644 --- a/client/settings/edition.py +++ b/client/settings/edition.py @@ -28,4 +28,4 @@ class Edition(Enum): # 版本号 # ======================== # puppy版本号,格式:浮点数,整数部分为8位日期,小数部分为编号(从1开始) -VERSION = 20220907.1 +VERSION = 20240716.1