🎨 优化安装依赖

This commit is contained in:
KimigaiiWuyi 2024-09-29 13:09:09 +08:00
parent fe69822a0c
commit 1ca76cd8dc

View File

@ -218,7 +218,7 @@ def install_dependencies(dependencies: Dict, need_update: bool = False):
logger.debug(f'[安装/更新依赖] 当前启动工具:{start_tool}') logger.debug(f'[安装/更新依赖] 当前启动工具:{start_tool}')
if start_tool.startswith('pdm'): if start_tool.startswith('pdm') and False:
result = subprocess.run( result = subprocess.run(
'pdm run python -m ensurepip', 'pdm run python -m ensurepip',
capture_output=True, capture_output=True,
@ -264,6 +264,7 @@ def install_dependencies(dependencies: Dict, need_update: bool = False):
logger.info(f'[安装/更新依赖] {dependency} 中...') logger.info(f'[安装/更新依赖] {dependency} 中...')
CMD = f'{start_tool} install "{dependency}{version}" {extra}' CMD = f'{start_tool} install "{dependency}{version}" {extra}'
try:
logger.info(f'[安装/更新依赖] 开始执行:{CMD}') logger.info(f'[安装/更新依赖] 开始执行:{CMD}')
result = subprocess.run( result = subprocess.run(
CMD, CMD,
@ -276,6 +277,8 @@ def install_dependencies(dependencies: Dict, need_update: bool = False):
else: else:
logger.warning("依赖安装失败。错误信息:") logger.warning("依赖安装失败。错误信息:")
logger.warning(result.stderr) logger.warning(result.stderr)
except Exception as e:
logger.exception(f'[安装/更新依赖] 安装失败:{e}')
installed_dependencies = get_installed_dependencies() installed_dependencies = get_installed_dependencies()