Prune PySide6 files in Windows build workflow
Refactor Windows build cleanup to use a dedicated $libDir and more aggressively prune unused PySide6/Qt files. Replaces direct $distDir references with $libDir for lib content and removes screenshots, PDBs, translations, many plugin folders, specific image/icon plugins (qpdf/qsvg/qsvgicon), platform input contexts, and common bulky Qt DLL patterns. Also removes several build tools/unused Python modules (setuptools, wheel, pkg_resources, _distutils_hack, curses, _pyrepl). Applied the same changes to both YTSage and YTSage-FFmpeg packaging steps to reduce bundle size and noise, and improved log messages for removed items.
This commit is contained in:
@@ -182,32 +182,65 @@ jobs:
|
|||||||
shell: powershell
|
shell: powershell
|
||||||
run: |
|
run: |
|
||||||
$distDir = "dist\YTSage"
|
$distDir = "dist\YTSage"
|
||||||
|
$libDir = "$distDir\lib"
|
||||||
if (Test-Path $distDir) {
|
if (Test-Path $distDir) {
|
||||||
# Remove screenshots
|
# Remove screenshots
|
||||||
if (Test-Path "$distDir\lib\assets\branding\screenshots") {
|
if (Test-Path "$libDir\assets\branding\screenshots") {
|
||||||
Remove-Item "$distDir\lib\assets\branding\screenshots" -Recurse -Force
|
Remove-Item "$libDir\assets\branding\screenshots" -Recurse -Force
|
||||||
Write-Host "Removed screenshots folder"
|
Write-Host "Removed screenshots folder"
|
||||||
}
|
}
|
||||||
# Remove debug PDB files
|
# Remove debug PDB files
|
||||||
Get-ChildItem -Path $distDir -Recurse -Filter "*.pdb" | Remove-Item -Force
|
Get-ChildItem -Path $distDir -Recurse -Filter "*.pdb" | Remove-Item -Force
|
||||||
Write-Host "Removed PDB debug files"
|
Write-Host "Removed PDB debug files"
|
||||||
# Remove unused Qt translations (if not needed for multilingual support)
|
|
||||||
if (Test-Path "$distDir\PySide6\translations") {
|
# Remove unused Qt translations (entire folder)
|
||||||
Remove-Item "$distDir\PySide6\translations" -Recurse -Force
|
if (Test-Path "$libDir\PySide6\translations") {
|
||||||
|
Remove-Item "$libDir\PySide6\translations" -Recurse -Force
|
||||||
Write-Host "Removed Qt translations"
|
Write-Host "Removed Qt translations"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Remove unused Qt plugins (based on your excludes; adjust if needed)
|
# Remove unused Qt plugins (based on your excludes; adjust if needed)
|
||||||
|
# Note: qpdf and qsvg plugins are removed specifically
|
||||||
$unusedPlugins = @("designer", "pdf", "svg", "sql", "help", "qml", "quick", "webengine", "bluetooth", "opengl", "printsupport", "test", "xml")
|
$unusedPlugins = @("designer", "pdf", "svg", "sql", "help", "qml", "quick", "webengine", "bluetooth", "opengl", "printsupport", "test", "xml")
|
||||||
foreach ($plugin in $unusedPlugins) {
|
foreach ($plugin in $unusedPlugins) {
|
||||||
if (Test-Path "$distDir\PySide6\plugins\$plugin") {
|
if (Test-Path "$libDir\PySide6\plugins\$plugin") {
|
||||||
Remove-Item "$distDir\PySide6\plugins\$plugin" -Recurse -Force
|
Remove-Item "$libDir\PySide6\plugins\$plugin" -Recurse -Force
|
||||||
Write-Host "Removed unused plugin: $plugin"
|
Write-Host "Removed unused plugin folder: $plugin"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# Explicitly remove virtualkeyboard input context if it exists
|
||||||
|
if (Test-Path "$libDir\PySide6\plugins\platforminputcontexts") {
|
||||||
|
Remove-Item "$libDir\PySide6\plugins\platforminputcontexts" -Recurse -Force
|
||||||
|
Write-Host "Removed plugin: platforminputcontexts"
|
||||||
|
}
|
||||||
|
# Explicitly remove specific image formats
|
||||||
|
foreach ($fmt in @("qpdf.dll", "qsvg.dll")) {
|
||||||
|
if (Test-Path "$libDir\PySide6\plugins\imageformats\$fmt") {
|
||||||
|
Remove-Item "$libDir\PySide6\plugins\imageformats\$fmt" -Force
|
||||||
|
Write-Host "Removed plugin: $fmt"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# Explicitly remove specific icon engines
|
||||||
|
if (Test-Path "$libDir\PySide6\plugins\iconengines\qsvgicon.dll") {
|
||||||
|
Remove-Item "$libDir\PySide6\plugins\iconengines\qsvgicon.dll" -Force
|
||||||
|
Write-Host "Removed plugin: qsvgicon.dll"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Remove any duplicate or unnecessary DLLs (e.g., Qt6Qml, Qt6Quick, Qt6OpenGL from root lib)
|
||||||
|
$bloatDlls = @("Qt6Web*", "Qt6Pdf*", "Qt6Qml*", "Qt6Quick*", "Qt6VirtualKeyboard*", "Qt6OpenGL*")
|
||||||
|
foreach ($pattern in $bloatDlls) {
|
||||||
|
Get-ChildItem -Path $libDir -Filter $pattern | Remove-Item -Force
|
||||||
|
}
|
||||||
|
Write-Host "Removed unnecessary Qt DLLs"
|
||||||
|
|
||||||
|
# Remove build tools and unused python modules
|
||||||
|
$uselessFolders = @("setuptools", "wheel", "pkg_resources", "_distutils_hack", "curses", "_pyrepl")
|
||||||
|
foreach ($folder in $uselessFolders) {
|
||||||
|
if (Test-Path "$libDir\$folder") {
|
||||||
|
Remove-Item "$libDir\$folder" -Recurse -Force
|
||||||
|
Write-Host "Removed unused module: $folder"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# Remove any duplicate or unnecessary DLLs (e.g., web-related)
|
|
||||||
Get-ChildItem -Path $distDir -Recurse -Filter "Qt6Web*" | Remove-Item -Force
|
|
||||||
Get-ChildItem -Path $distDir -Recurse -Filter "Qt6Pdf*" | Remove-Item -Force
|
|
||||||
Write-Host "Removed additional unnecessary Qt files"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- name: Setup FFmpeg for bundle
|
- name: Setup FFmpeg for bundle
|
||||||
@@ -293,32 +326,65 @@ jobs:
|
|||||||
shell: powershell
|
shell: powershell
|
||||||
run: |
|
run: |
|
||||||
$distDir = "dist\YTSage-FFmpeg"
|
$distDir = "dist\YTSage-FFmpeg"
|
||||||
|
$libDir = "$distDir\lib"
|
||||||
if (Test-Path $distDir) {
|
if (Test-Path $distDir) {
|
||||||
# Remove screenshots
|
# Remove screenshots
|
||||||
if (Test-Path "$distDir\lib\assets\branding\screenshots") {
|
if (Test-Path "$libDir\assets\branding\screenshots") {
|
||||||
Remove-Item "$distDir\lib\assets\branding\screenshots" -Recurse -Force
|
Remove-Item "$libDir\assets\branding\screenshots" -Recurse -Force
|
||||||
Write-Host "Removed screenshots folder"
|
Write-Host "Removed screenshots folder"
|
||||||
}
|
}
|
||||||
# Remove debug PDB files
|
# Remove debug PDB files
|
||||||
Get-ChildItem -Path $distDir -Recurse -Filter "*.pdb" | Remove-Item -Force
|
Get-ChildItem -Path $distDir -Recurse -Filter "*.pdb" | Remove-Item -Force
|
||||||
Write-Host "Removed PDB debug files"
|
Write-Host "Removed PDB debug files"
|
||||||
# Remove unused Qt translations (if not needed for multilingual support)
|
|
||||||
if (Test-Path "$distDir\PySide6\translations") {
|
# Remove unused Qt translations (entire folder)
|
||||||
Remove-Item "$distDir\PySide6\translations" -Recurse -Force
|
if (Test-Path "$libDir\PySide6\translations") {
|
||||||
|
Remove-Item "$libDir\PySide6\translations" -Recurse -Force
|
||||||
Write-Host "Removed Qt translations"
|
Write-Host "Removed Qt translations"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Remove unused Qt plugins (based on your excludes; adjust if needed)
|
# Remove unused Qt plugins (based on your excludes; adjust if needed)
|
||||||
|
# Note: qpdf and qsvg plugins are removed specifically
|
||||||
$unusedPlugins = @("designer", "pdf", "svg", "sql", "help", "qml", "quick", "webengine", "bluetooth", "opengl", "printsupport", "test", "xml")
|
$unusedPlugins = @("designer", "pdf", "svg", "sql", "help", "qml", "quick", "webengine", "bluetooth", "opengl", "printsupport", "test", "xml")
|
||||||
foreach ($plugin in $unusedPlugins) {
|
foreach ($plugin in $unusedPlugins) {
|
||||||
if (Test-Path "$distDir\PySide6\plugins\$plugin") {
|
if (Test-Path "$libDir\PySide6\plugins\$plugin") {
|
||||||
Remove-Item "$distDir\PySide6\plugins\$plugin" -Recurse -Force
|
Remove-Item "$libDir\PySide6\plugins\$plugin" -Recurse -Force
|
||||||
Write-Host "Removed unused plugin: $plugin"
|
Write-Host "Removed unused plugin folder: $plugin"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# Explicitly remove virtualkeyboard input context if it exists
|
||||||
|
if (Test-Path "$libDir\PySide6\plugins\platforminputcontexts") {
|
||||||
|
Remove-Item "$libDir\PySide6\plugins\platforminputcontexts" -Recurse -Force
|
||||||
|
Write-Host "Removed plugin: platforminputcontexts"
|
||||||
|
}
|
||||||
|
# Explicitly remove specific image formats
|
||||||
|
foreach ($fmt in @("qpdf.dll", "qsvg.dll")) {
|
||||||
|
if (Test-Path "$libDir\PySide6\plugins\imageformats\$fmt") {
|
||||||
|
Remove-Item "$libDir\PySide6\plugins\imageformats\$fmt" -Force
|
||||||
|
Write-Host "Removed plugin: $fmt"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# Explicitly remove specific icon engines
|
||||||
|
if (Test-Path "$libDir\PySide6\plugins\iconengines\qsvgicon.dll") {
|
||||||
|
Remove-Item "$libDir\PySide6\plugins\iconengines\qsvgicon.dll" -Force
|
||||||
|
Write-Host "Removed plugin: qsvgicon.dll"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Remove any duplicate or unnecessary DLLs (e.g., Qt6Qml, Qt6Quick, Qt6OpenGL from root lib)
|
||||||
|
$bloatDlls = @("Qt6Web*", "Qt6Pdf*", "Qt6Qml*", "Qt6Quick*", "Qt6VirtualKeyboard*", "Qt6OpenGL*")
|
||||||
|
foreach ($pattern in $bloatDlls) {
|
||||||
|
Get-ChildItem -Path $libDir -Filter $pattern | Remove-Item -Force
|
||||||
|
}
|
||||||
|
Write-Host "Removed unnecessary Qt DLLs"
|
||||||
|
|
||||||
|
# Remove build tools and unused python modules
|
||||||
|
$uselessFolders = @("setuptools", "wheel", "pkg_resources", "_distutils_hack", "curses", "_pyrepl")
|
||||||
|
foreach ($folder in $uselessFolders) {
|
||||||
|
if (Test-Path "$libDir\$folder") {
|
||||||
|
Remove-Item "$libDir\$folder" -Recurse -Force
|
||||||
|
Write-Host "Removed unused module: $folder"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# Remove any duplicate or unnecessary DLLs (e.g., web-related)
|
|
||||||
Get-ChildItem -Path $distDir -Recurse -Filter "Qt6Web*" | Remove-Item -Force
|
|
||||||
Get-ChildItem -Path $distDir -Recurse -Filter "Qt6Pdf*" | Remove-Item -Force
|
|
||||||
Write-Host "Removed additional unnecessary Qt files"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- name: Package and prepare release artifacts (ZIPs)
|
- name: Package and prepare release artifacts (ZIPs)
|
||||||
|
|||||||
Reference in New Issue
Block a user