👑 优化更新方式 by 一只瓜 | 🍉

This commit is contained in:
Xtao_dada 2020-08-05 09:58:59 +08:00 committed by GitHub
parent 68ce61ca23
commit 8ff775fa89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -73,9 +73,13 @@ async def update(context):
await context.edit('找到更新,正在拉取 . . .') await context.edit('找到更新,正在拉取 . . .')
try: try:
upstream_remote.pull(active_branch) # upstream_remote.pull(active_branch)
await execute("pip3 install -r requirements.txt --upgrade") await execute("""git status | grep modified | sed -r "s/ +/ /" | cut -f2 | awk -F " " '{print "mkdir -p $(dirname ../for-update/" $2 ") && mv " $2 " ../for-update/" $2}' | sh""")
await execute("pip3 install -r requirements.txt") await execute("git pull")
await execute("""cd ../for-update/ && find -H . -type f | awk '{print "cp " $1 " ../PagerMaid-Modify/" $1}' | sh && cd ../PagerMaid-Modify""")
await execute("rm -rf ../for-update/")
await execute("python3 -m pip install -r requirements.txt --upgrade")
await execute("python3 -m pip install -r requirements.txt")
await log("PagerMaid-Modify 已更新。") await log("PagerMaid-Modify 已更新。")
await context.edit( await context.edit(
'更新成功PagerMaid-Modify 正在重新启动。' '更新成功PagerMaid-Modify 正在重新启动。'