简化安装依赖的命令构建逻辑

This commit is contained in:
HibiKier 2025-06-04 14:10:17 +08:00
parent 922ca71e7d
commit 13b690c23a

View File

@ -20,6 +20,10 @@ from .config import BASE_PATH, DEFAULT_GITHUB_URL, EXTRA_GITHUB_URL
BAT_FILE = Path() / "win启动.bat" BAT_FILE = Path() / "win启动.bat"
WIN_COMMAND = ["./Python310/python.exe", "-m", "pip", "install", "-r"]
DEFAULT_COMMAND = ["poetry", "run", "pip", "install", "-r"]
def row_style(column: str, text: str) -> RowStyle: def row_style(column: str, text: str) -> RowStyle:
"""被动技能文本风格 """被动技能文本风格
@ -52,24 +56,8 @@ def install_requirement(plugin_path: Path):
return return
try: try:
if BAT_FILE.exists(): command = WIN_COMMAND if BAT_FILE.exists() else DEFAULT_COMMAND
command = [ command.append(str(existing_requirements))
"./Python310/python.exe",
"-m",
"pip",
"install",
"-r",
str(existing_requirements),
]
else:
command = [
"poetry",
"run",
"pip",
"install",
"-r",
str(existing_requirements),
]
result = subprocess.run( result = subprocess.run(
command, command,
check=True, check=True,