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:
guihkx
2023-06-10 08:32:35 -03:00
committed by DevilXD
parent 5162e5c553
commit ed8c598180

View File

@@ -3,7 +3,7 @@ from __future__ import annotations
import sys
from pathlib import Path
from typing import TYPE_CHECKING
from typing import Any, TYPE_CHECKING
SELF_PATH = str(Path(".").absolute())
if SELF_PATH not in sys.path:
@@ -34,6 +34,7 @@ for source_path, dest_path, required in to_add:
elif required:
raise FileNotFoundError(str(source_path))
hooksconfig: dict[str, Any] = {}
binaries: list[tuple[Path, str]] = []
hiddenimports: list[str] = [
"PIL._tkinter_finder",
@@ -51,6 +52,13 @@ if sys.platform == "linux":
"gi.repository.Gtk",
"gi.repository.GObject",
])
hooksconfig = {
"gi": {
"icons": [],
"themes": [],
"languages": ["en_US"]
}
}
block_cipher = None
a = Analysis(
@@ -59,11 +67,11 @@ a = Analysis(
datas=datas,
excludes=[],
hookspath=[],
hooksconfig={},
noarchive=False,
runtime_hooks=[],
binaries=binaries,
cipher=block_cipher,
hooksconfig=hooksconfig,
hiddenimports=hiddenimports,
win_private_assemblies=False,
win_no_prefer_redirects=False,