-
Notifications
You must be signed in to change notification settings - Fork 88
/
Copy pathpost_setup.py
39 lines (30 loc) · 1.06 KB
/
post_setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import pathlib
import sys
def remove_some_redundant_qt_files() -> None:
current_dir = pathlib.Path(__file__).parent
build_dir = current_dir / "build"
app_dir, = build_dir.iterdir()
app_qt6 = app_dir / "lib" / "PyQt6" / "Qt6"
# cx_Freeze copies these into lib directory itself
# and into every plugin directory for some reason
libfiles = [file.name for file in (app_qt6 / "lib").iterdir()]
# not all of them, but the most obvious and largest ones
redundant_plugins_files = [
"libffmpegmediaplugin.so",
"libQt6Pdf.so.6",
"libQt6Qml.so.6",
"libQt6QmlModels.so.6",
"libQt6Quick.so.6",
]
plugins_dir = app_qt6 / "plugins"
for plugin in plugins_dir.iterdir():
for file in plugin.iterdir():
if file.name in libfiles + redundant_plugins_files:
print(f"Removing {file}...")
file.unlink()
def main() -> None:
if sys.platform == "win32":
return
remove_some_redundant_qt_files()
if __name__ == "__main__":
raise SystemExit(main())