From 8ff775fa89cde3f7246526f65307588a999d6341 Mon Sep 17 00:00:00 2001 From: Xtao_dada Date: Wed, 5 Aug 2020 09:58:59 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=91=91=20=E4=BC=98=E5=8C=96=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E6=96=B9=E5=BC=8F=20by=20=E4=B8=80=E5=8F=AA=E7=93=9C?= =?UTF-8?q?=20|=20=F0=9F=8D=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pagermaid/modules/update.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/pagermaid/modules/update.py b/pagermaid/modules/update.py index a27fc4a..c39311c 100644 --- a/pagermaid/modules/update.py +++ b/pagermaid/modules/update.py @@ -73,9 +73,13 @@ async def update(context): await context.edit('找到更新,正在拉取 . . .') try: - upstream_remote.pull(active_branch) - await execute("pip3 install -r requirements.txt --upgrade") - await execute("pip3 install -r requirements.txt") + # upstream_remote.pull(active_branch) + 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("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 context.edit( '更新成功,PagerMaid-Modify 正在重新启动。'