mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2026-10-09 05:40:00 +08:00
🎨 签到优化与配置修改
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import tarfile
|
||||
import zipfile
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
from nonebot.adapters import Bot
|
||||
@@ -21,24 +21,34 @@ from .config import (
|
||||
MAIN_URL,
|
||||
PYPROJECT_FILE,
|
||||
PYPROJECT_LOCK_FILE,
|
||||
REQ_TXT_FILE,
|
||||
RELEASE_URL,
|
||||
REPLACE_FOLDERS,
|
||||
REQ_TXT_FILE,
|
||||
TMP_PATH,
|
||||
VERSION_FILE,
|
||||
)
|
||||
|
||||
|
||||
def install_requirement():
|
||||
requirement_path = (Path() / "requirements.txt").absolute()
|
||||
|
||||
|
||||
if not requirement_path.exists():
|
||||
logger.debug(f"没有找到zhenxun的requirement.txt,目标路径为{requirement_path}", "插件管理")
|
||||
logger.debug(
|
||||
f"没有找到zhenxun的requirement.txt,目标路径为{requirement_path}", "插件管理"
|
||||
)
|
||||
return
|
||||
try:
|
||||
result = subprocess.run(["pip", "install", "-r", str(requirement_path)], check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
|
||||
result = subprocess.run(
|
||||
["pip", "install", "-r", str(requirement_path)],
|
||||
check=True,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
text=True,
|
||||
)
|
||||
logger.debug(f"成功安装真寻依赖,日志:\n{result.stdout}", "插件管理")
|
||||
except subprocess.CalledProcessError as e:
|
||||
logger.error(f"安装真寻依赖失败,错误:\n{e.stderr}")
|
||||
logger.error(f"安装真寻依赖失败,错误:\n{e.stderr}", "插件管理", e=e)
|
||||
|
||||
|
||||
@run_sync
|
||||
def _file_handle(latest_version: str | None):
|
||||
@@ -120,6 +130,7 @@ def _file_handle(latest_version: str | None):
|
||||
f.write(f"__version__: {latest_version}")
|
||||
install_requirement()
|
||||
|
||||
|
||||
class UpdateManage:
|
||||
|
||||
@classmethod
|
||||
|
||||
Reference in New Issue
Block a user