summaryrefslogtreecommitdiff
path: root/backend/pyinstaller.spec
blob: 3ef888f533da7b72a84f25ec8570d7b2033576a5 (plain)
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
import os
from PyInstaller.building.build_main import Analysis
from PyInstaller.building.api import EXE, PYZ
from PyInstaller.utils.hooks import copy_metadata

noconsole_str = os.getenv('DECKY_NOCONSOLE', '0')
noconsole = bool(noconsole_str)
repo = os.getenv('DECKY_REPO', 'SteamDeckHomebrew/decky-loader')
branch = os.getenv('DECKY_BRANCH', 'main')
with open('build_config.py', 'w') as f:
    f.write(f"""
import os
os.environ['DECKY_PACKAGED_BUILD'] = '1'

# Build info
os.environ['DECKY_REPO'] = {repr(repo)}
os.environ['DECKY_BRANCH'] = {repr(branch)}

# Windows-specific
os.environ['DECKY_NOCONSOLE'] = {repr(noconsole_str)}
""")

name = "PluginLoader"
# if noconsole:
#    name += "_noconsole"

a = Analysis(
    ['main.py'],
    datas=[
        ('decky_loader/locales', 'decky_loader/locales'),
        ('decky_loader/static', 'decky_loader/static'),
    ] + copy_metadata('decky_loader'),
    runtime_hooks=['build_config.py'],
    hiddenimports=['logging.handlers', 'sqlite3', 'http.server', 'socketserver', 'configparser', 'decky_plugin', 'decky'],
)
pyz = PYZ(a.pure, a.zipped_data)

exe = EXE(
    pyz,
    a.scripts,
    a.binaries,
    a.zipfiles,
    a.datas,
    name=name,
    upx=True,
    console=not noconsole,
)