From e1352586b7bbff39886fb8fb80b03f6a56e8b64a Mon Sep 17 00:00:00 2001 From: DLmaster Date: Sun, 29 Dec 2024 01:42:03 +0800 Subject: [PATCH] =?UTF-8?q?Updater=E6=94=B9=E4=B8=BA=E7=8B=AC=E7=AB=8B?= =?UTF-8?q?=E6=89=93=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/utils/Updater.py | 2 +- app/utils/package.py | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/app/utils/Updater.py b/app/utils/Updater.py index bfc54db..b846699 100644 --- a/app/utils/Updater.py +++ b/app/utils/Updater.py @@ -21,7 +21,7 @@ """ AUTO_MAA AUTO_MAA更新器 -v1.0 +v1.1 作者:DLmaster_361 """ diff --git a/app/utils/package.py b/app/utils/package.py index ae7be05..fcaf9f9 100644 --- a/app/utils/package.py +++ b/app/utils/package.py @@ -25,7 +25,9 @@ v4.2 作者:DLmaster_361 """ +import os import json +import shutil import subprocess from app import version_text @@ -55,6 +57,19 @@ if __name__ == "__main__": capture_output=True, text=True, ) + + shutil.copy(os.path.normpath("app/utils/Updater.py"), os.path.normpath(".")) + + with open(os.path.normpath("Updater.py"), "r", encoding="utf-8") as f: + file_content = f.read() + + file_content = file_content.replace( + "from .version import version_text", "from app import version_text" + ) + + with open(os.path.normpath("Updater.py"), "w", encoding="utf-8") as f: + f.write(file_content) + result = subprocess.run( f"powershell -Command nuitka --standalone --onefile --mingw64" f" --enable-plugins=pyside6 --windows-console-mode=disable" @@ -66,7 +81,7 @@ if __name__ == "__main__": f" --copyright='Copyright © 2024 DLmaster361'" f" --assume-yes-for-downloads --show-progress" f" --output-filename=Updater --remove-output" - f" app\\utils\\Updater.py", + f" Updater.py", shell=True, capture_output=True, text=True,