pyinstaller: avoid bundling icon and themes on Linux

This greatly reduces the final size of the UPX-compressed binary, from
78.7 MiB to 54.9 MiB (a 23.8 MiB difference)!

Co-authored-by: DevilXD <bartosz.peszek@gmail.com>
This commit is contained in:
guihkxandDevilXD authored and DevilXD committed 2023-06-11 16:58:18 +02:00
1 parent 5162e5c553
commit ed8c598180
1 file changed
+10 -2
+10 -2
View File
@@ -3,7 +3,7 @@ from __future__ import annotations
import sys import sys
from pathlib import Path from pathlib import Path
from typing import TYPE_CHECKING from typing import Any, TYPE_CHECKING
SELF_PATH = str(Path(".").absolute()) SELF_PATH = str(Path(".").absolute())
if SELF_PATH not in sys.path: if SELF_PATH not in sys.path:
@@ -34,6 +34,7 @@ for source_path, dest_path, required in to_add:
elif required: elif required:
raise FileNotFoundError(str(source_path)) raise FileNotFoundError(str(source_path))
hooksconfig: dict[str, Any] = {}
binaries: list[tuple[Path, str]] = [] binaries: list[tuple[Path, str]] = []
hiddenimports: list[str] = [ hiddenimports: list[str] = [
"PIL._tkinter_finder", "PIL._tkinter_finder",
@@ -51,6 +52,13 @@ if sys.platform == "linux":
"gi.repository.Gtk", "gi.repository.Gtk",
"gi.repository.GObject", "gi.repository.GObject",
]) ])
hooksconfig = {
"gi": {
"icons": [],
"themes": [],
"languages": ["en_US"]
}
}
block_cipher = None block_cipher = None
a = Analysis( a = Analysis(
@@ -59,11 +67,11 @@ a = Analysis(
datas=datas, datas=datas,
excludes=[], excludes=[],
hookspath=[], hookspath=[],
hooksconfig={},
noarchive=False, noarchive=False,
runtime_hooks=[], runtime_hooks=[],
binaries=binaries, binaries=binaries,
cipher=block_cipher, cipher=block_cipher,
hooksconfig=hooksconfig,
hiddenimports=hiddenimports, hiddenimports=hiddenimports,
win_private_assemblies=False, win_private_assemblies=False,
win_no_prefer_redirects=False, win_no_prefer_redirects=False,