Skip to content

The only downloader you need. 下载器的集大成者。

build(deploy): 不打包 QtPdf

XiaoYouChRc3efad73de84
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index fca8d06f..f040e553 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -31,7 +31,7 @@ on:
- 'true'
- 'false'
sign_artifact:
- description: 'Sign Artifact (Windows)'
+ description: 'Sign Artifact'
required: true
default: 'true'
type: choice
@@ -400,7 +400,7 @@ jobs:
openssl_workaround: 'true'
runs-on: ${{ matrix.runner }}
env:
- HAS_APPLE_CERT: ${{ secrets.APPLE_CERTIFICATE != '' && 'true' || 'false' }}
+ SHOULD_SIGN: ${{ github.event.inputs.sign_artifact == 'true' && secrets.APPLE_CERTIFICATE != '' && 'true' || 'false' }}
steps:
- name: Checkout
uses: actions/checkout@v7
@@ -452,7 +452,7 @@ jobs:
run: uv run scripts/restructure_macos_bundle.py "dist/Ghost Downloader.app"
- name: Import signing certificate
- if: ${{ env.HAS_APPLE_CERT == 'true' }}
+ if: ${{ env.SHOULD_SIGN == 'true' }}
env:
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
@@ -476,7 +476,7 @@ jobs:
rm -f "$CERT_PATH"
- name: Sign app bundle
- if: ${{ env.HAS_APPLE_CERT == 'true' }}
+ if: ${{ env.SHOULD_SIGN == 'true' }}
env:
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
run: |
@@ -534,7 +534,7 @@ jobs:
"$DMG_SOURCE_DIR"
- name: Notarize DMG
- if: ${{ env.HAS_APPLE_CERT == 'true' }}
+ if: ${{ env.SHOULD_SIGN == 'true' }}
env:
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_APP_PASSWORD: ${{ secrets.APPLE_APP_PASSWORD }}
@@ -566,7 +566,7 @@ jobs:
echo "Notarization complete."
- name: Cleanup keychain
- if: ${{ always() && env.HAS_APPLE_CERT == 'true' }}
+ if: ${{ always() && env.SHOULD_SIGN == 'true' }}
run: security delete-keychain "$KEYCHAIN_PATH" 2>/dev/null || true
- name: Generate patch
diff --git a/scripts/deploy.py b/scripts/deploy.py
index d733d30f..a16c74ec 100644
--- a/scripts/deploy.py
+++ b/scripts/deploy.py
@@ -24,6 +24,12 @@ EXTRA_INCLUDE_PACKAGES = []
PLATFORM_INCLUDE_PACKAGES = {
"win32": ["winrt"],
}
+# 应用不读 PDF 图像。只排除 PDF 插件时,Nuitka 仍会打包它依赖的 QtPdf,所以两个都排除。
+PLATFORM_EXCLUDED_DLLS = {
+ "win32": ["PySide6/qt-plugins/imageformats/qpdf.dll", "qt6pdf.dll"],
+ "darwin": ["PySide6/qt-plugins/imageformats/libqpdf.dylib", "QtPdf"],
+ "linux": ["PySide6/qt-plugins/imageformats/libqpdf.so", "libQt6Pdf.so.6"],
+}
EXTRA_INCLUDE_MODULES = [
"app.view.dialogs.edit_task",
"concurrent.futures",
@@ -128,6 +134,7 @@ def buildArgs() -> list[str]:
dataArgs = [
'--include-data-files=app/assets/resources.rcc=app/assets/resources.rcc',
]
+ excludeArgs = [f"--noinclude-dlls={path}" for path in PLATFORM_EXCLUDED_DLLS[sys.platform]]
if sys.platform == "win32":
return [
@@ -137,6 +144,7 @@ def buildArgs() -> list[str]:
'--plugin-enable=pyside6',
*includeArgs,
*dataArgs,
+ *excludeArgs,
'--assume-yes-for-downloads',
'--msvc=latest',
'--windows-icon-from-ico=app/assets/logo.ico',
@@ -159,6 +167,7 @@ def buildArgs() -> list[str]:
'--plugin-enable=pyside6',
*includeArgs,
*dataArgs,
+ *excludeArgs,
'--static-libpython=no',
"--macos-create-app-bundle",
"--assume-yes-for-downloads",
@@ -177,6 +186,7 @@ def buildArgs() -> list[str]:
'--plugin-enable=pyside6',
*includeArgs,
*dataArgs,
+ *excludeArgs,
'--include-qt-plugins=platforms',
'--include-module=PySide6.QtDBus',
'--assume-yes-for-downloads',