From 3c57b990649e9061e09f6665f92aa7a09bdcf79f Mon Sep 17 00:00:00 2001 From: haosicheng Date: Mon, 13 Oct 2025 15:31:54 +0800 Subject: [PATCH] =?UTF-8?q?[patch]=20=E4=BF=AE=E6=94=B9=E6=89=93=E5=8C=85?= =?UTF-8?q?=E5=9B=BA=E5=AE=9A=E9=A1=B9=E7=BC=93=E5=AD=98=E5=A4=8D=E7=94=A8?= =?UTF-8?q?=20=E6=8F=90=E5=8D=87=E6=89=93=E5=8C=85=E6=95=88=E7=8E=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/gui-version-release.yml | 4 --- quick_build.py | 41 +----------------------- 2 files changed, 1 insertion(+), 44 deletions(-) diff --git a/.gitea/workflows/gui-version-release.yml b/.gitea/workflows/gui-version-release.yml index d07d65e..94be626 100644 --- a/.gitea/workflows/gui-version-release.yml +++ b/.gitea/workflows/gui-version-release.yml @@ -135,10 +135,6 @@ jobs: - name: Build production executable if: success() shell: powershell - # Optional: Set FORCE_FULL_CLEAN=true to force complete rebuild (clears build cache) - # Default: Incremental build mode (preserves build cache for faster builds) - # env: - # FORCE_FULL_CLEAN: "true" run: | Write-Host "=========================================="; Write-Host "Step 4.5: Build production executable"; diff --git a/quick_build.py b/quick_build.py index ca0a839..2a611ee 100644 --- a/quick_build.py +++ b/quick_build.py @@ -9,11 +9,6 @@ import subprocess import shutil from pathlib import Path -# Build optimization: Control whether to force full clean -# Set environment variable FORCE_FULL_CLEAN=true to clean both dist and build directories -# Default: false (incremental build, faster) -FORCE_FULL_CLEAN = os.getenv('FORCE_FULL_CLEAN', 'false').lower() == 'true' - def clean_build(): """清理构建目录""" @@ -27,25 +22,7 @@ def clean_build(): print("Waiting for file handles to release...") time.sleep(0.5) - # Build optimization: Preserve build cache for faster incremental builds - # The build directory contains PyInstaller analysis cache - # Preserving it can reduce build time from ~7min to ~3min - if FORCE_FULL_CLEAN: - dirs_to_clean = ['dist', 'build'] - print("FORCE_FULL_CLEAN enabled - cleaning all directories including build cache") - else: - dirs_to_clean = ['dist'] - print("Incremental build mode - preserving build cache for faster builds") - - # Always remove spec file to ensure PyInstaller regenerates it from command-line args - spec_file = 'MultiPlatformGUI.spec' - if os.path.exists(spec_file): - try: - os.remove(spec_file) - print(f"Removed old spec file: {spec_file}") - except Exception as e: - print(f"WARNING: Failed to remove spec file: {e}") - + dirs_to_clean = ['dist', 'build'] for dir_name in dirs_to_clean: print(f"Checking directory: {dir_name}") if os.path.exists(dir_name): @@ -79,9 +56,6 @@ def build_with_command(): '--name=MultiPlatformGUI', # 直接使用最终目录名 '--onedir', # 相当于 --exclude-binaries '--windowed', # 相当于 -w - '--noconfirm', # Build optimization: Skip confirmation prompts - '--log-level=WARN', # Build optimization: Reduce log output (only warnings and errors) - '--noupx', # Build optimization: Skip UPX compression (saves time, minimal size impact) '--icon=static/ai_assistant_icon_64.png', # 添加主程序图标 '--add-data=config.py;.', '--add-data=exe_file_logger.py;.', @@ -123,19 +97,6 @@ def build_with_command(): if result.returncode == 0: print("Build successful!") print("Build result: dist/MultiPlatformGUI/") - - # Debug: List files in dist directory - if os.path.exists('dist/MultiPlatformGUI'): - print("DEBUG: Files in dist/MultiPlatformGUI/:") - for item in os.listdir('dist/MultiPlatformGUI'): - item_path = os.path.join('dist/MultiPlatformGUI', item) - if os.path.isfile(item_path): - size_mb = os.path.getsize(item_path) / 1024 / 1024 - print(f" - {item} ({size_mb:.1f} MB)") - else: - print(f" - {item}/ (directory)") - else: - print("WARNING: dist/MultiPlatformGUI directory does not exist!") # 验证输出目录(不需要重命名了) if os.path.exists('dist/MultiPlatformGUI/MultiPlatformGUI.exe'):