def wrapper(self):
     logger.disabled = False
     logger.removeHandler(searcher_handler)
     logger.addHandler(tests_handler)
     logger.info('%s' % func.__name__)
     func(self)
     logger.removeHandler(tests_handler)
     logger.addHandler(searcher_handler)
Beispiel #2
0
# 更新器不启用文件日志
from log import logger, fileHandler, new_file_handler, color
from version import now_version

logger.name = "auto_updater"
logger.removeHandler(fileHandler)
logger.addHandler(new_file_handler())

import argparse
import os
import subprocess
from distutils import dir_util
from upload_lanzouyun import Uploader, lanzou_cookie
from update import need_update
from util import kill_process

bandizip_executable_path = "./bandizip_portable/bz.exe"
tmp_dir = "_update_temp_dir"

# note: 作为cwd的默认值,用于检测是否直接双击自动更新工具
invalid_cwd = "./invalid_cwd"

auto_updater_version = "1.0.5"


# 自动更新的基本原型,日后想要加这个逻辑的时候再细化接入
def auto_update():
    args = parse_args()

    logger.info(
        f"更新器的进程为{os.getpid()}, 版本为{auto_updater_version}(主代码版本为{now_version}),主进程为{args.pid}, 版本为{args.version}"