forked from DevilXD/TwitchDropsMiner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.spec
100 lines (91 loc) · 2.79 KB
/
build.spec
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# -*- mode: python ; coding: utf-8 -*-
from __future__ import annotations
import sys
from pathlib import Path
from typing import Any, TYPE_CHECKING
SELF_PATH = str(Path(".").absolute())
if SELF_PATH not in sys.path:
sys.path.insert(0, SELF_PATH)
from constants import WORKING_DIR, SITE_PACKAGES_PATH, DEFAULT_LANG
if TYPE_CHECKING:
from PyInstaller.building.api import PYZ, EXE
from PyInstaller.building.build_main import Analysis
# (source_path, dest_path, required)
to_add: list[tuple[Path, str, bool]] = [
(Path("pickaxe.ico"), '.', True), # icon file
# SeleniumWire HTTPS/SSL cert file and key
(Path(SITE_PACKAGES_PATH, "seleniumwire/ca.crt"), "./seleniumwire", False),
(Path(SITE_PACKAGES_PATH, "seleniumwire/ca.key"), "./seleniumwire", False),
]
for lang_filepath in WORKING_DIR.joinpath("lang").glob("*.json"):
if lang_filepath.stem != DEFAULT_LANG:
to_add.append((lang_filepath, "lang", True))
# ensure the required to-be-added data exists
datas: list[tuple[Path, str]] = []
for source_path, dest_path, required in to_add:
if source_path.exists():
datas.append((source_path, dest_path))
elif required:
raise FileNotFoundError(str(source_path))
hooksconfig: dict[str, Any] = {}
binaries: list[tuple[Path, str]] = []
hiddenimports: list[str] = [
"PIL._tkinter_finder",
"setuptools._distutils.log",
"setuptools._distutils.dir_util",
"setuptools._distutils.file_util",
"setuptools._distutils.archive_util",
]
if sys.platform == "linux":
# Needed files for better system tray support on Linux via pystray (AppIndicator backend).
datas.append((Path("/usr/lib/girepository-1.0/AppIndicator3-0.1.typelib"), "gi_typelibs"))
binaries.append((Path("/lib/x86_64-linux-gnu/libappindicator3.so.1"), "."))
hiddenimports.extend([
"gi.repository.Gtk",
"gi.repository.GObject",
])
hooksconfig = {
"gi": {
"icons": [],
"themes": [],
"languages": ["en_US"]
}
}
block_cipher = None
a = Analysis(
["main.py"],
pathex=[],
datas=datas,
excludes=[],
hookspath=[],
noarchive=False,
runtime_hooks=[],
binaries=binaries,
cipher=block_cipher,
hooksconfig=hooksconfig,
hiddenimports=hiddenimports,
win_private_assemblies=False,
win_no_prefer_redirects=False,
)
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
exe = EXE(
pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
upx=True,
debug=False,
strip=False,
console=False,
upx_exclude=[],
target_arch=None,
icon="pickaxe.ico",
runtime_tmpdir=None,
codesign_identity=None,
entitlements_file=None,
bootloader_ignore_signals=False,
disable_windowed_traceback=False,
name="Twitch Drops Miner (by DevilXD)",
)