forked from leminlimez/Nugget
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompile.py
More file actions
52 lines (45 loc) · 1.4 KB
/
Copy pathcompile.py
File metadata and controls
52 lines (45 loc) · 1.4 KB
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
from sys import platform, argv
import os
import PyInstaller.__main__
target_arch=None
for n in argv:
if n.startswith("--target-arch="):
print(f"Target arch: {n}")
target_arch=n
args = [
'main_app.py',
# '--hidden-import=ipsw_parser',
'--hidden-import=zeroconf',
'--hidden-import=pyimg4',
'--hidden-import=zeroconf._utils.ipaddress',
'--hidden-import=zeroconf._handlers.answers',
'--add-data=files/:./files',
'--copy-metadata=pyimg4',
'--onedir',
'--noconfirm',
'--name=Nugget',
'--icon=nugget.ico'
]
if target_arch == None:
args.append('--optimize=2')
if platform == "darwin":
# add --windowed arg for macOS
args.append('--windowed')
args.append('--osx-bundle-identifier=com.leemin.Nugget')
if target_arch != None:
args.append(target_arch)
# codesigning resources
try:
import secrets.compile_config as compile_config
args.append('--osx-entitlements-file=entitlements.plist')
args.append(f"--codesign-identity={compile_config.CODESIGN_HASH}")
except ImportError:
print("No compile_config found, ignoring codesign...")
elif os.name == 'nt':
# add windows version info
args.append('--version-file=version.txt')
if os.path.exists("ffmpeg/bin"):
args.append('--add-data=ffmpeg/bin:ffmpeg/bin')
else:
print("ffmpeg not found!")
PyInstaller.__main__.run(args)