-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.spec
More file actions
114 lines (100 loc) · 2.86 KB
/
Copy pathbuild.spec
File metadata and controls
114 lines (100 loc) · 2.86 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
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# -*- mode: python ; coding: utf-8 -*-
import sys
import platform
import os
import re
if sys.platform == 'win32':
import io
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding='utf-8')
spec_dir = os.path.dirname(os.path.abspath(sys.argv[0]))
src_path = os.path.join(spec_dir, 'src')
def get_version_from_file():
utils_path = os.path.join(src_path, 'utils.py')
try:
with open(utils_path, 'r', encoding='utf-8') as f:
content = f.read()
match = re.search(r'VERSION\s*=\s*["\']([^"\']+)["\']', content)
if match:
return match.group(1)
except Exception as e:
print(f"Не удалось прочитать версию из {utils_path}: {e}")
return "v0.0.0"
VERSION = get_version_from_file()
system = platform.system().lower()
is_macos = system == 'darwin'
print(f"Сборка FLauncher {VERSION} для {platform.system()}")
params = {
'windows': {
'separator': ';',
'icon': os.path.join('src', 'ui', 'icon.ico'),
'name': f'FLauncher-{VERSION}.exe',
'console': False
},
'linux': {
'separator': ':',
'icon': os.path.join('src', 'ui', 'icon.png'),
'name': f'FLauncher-{VERSION}',
'console': False
},
'darwin': {
'separator': ':',
'icon': os.path.join('src', 'ui', 'icon.icns'),
'name': f'FLauncher-{VERSION}',
'console': False
}
}
p = params.get(system, params['linux'])
if is_macos:
app_name = f'FLauncher-{VERSION}.app'
else:
app_name = None
a = Analysis(
['src/main.py'],
pathex=['src'],
binaries=[],
datas=[('src/ui', 'ui')],
hiddenimports=[],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
noarchive=False,
)
pyz = PYZ(a.pure)
exe = EXE(
pyz,
a.scripts,
a.binaries,
a.datas,
[],
name=p['name'],
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=p['console'],
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
icon=p['icon']
)
if is_macos:
app = BUNDLE(
exe,
name=app_name,
icon=p['icon'],
bundle_identifier='com.flauncher.app',
info_plist={
'NSPrincipalClass': 'NSApplication',
'NSHighResolutionCapable': 'True',
'CFBundleShortVersionString': VERSION.replace('v', ''),
'CFBundleVersion': VERSION.replace('v', ''),
'CFBundleName': f'FLauncher {VERSION}',
'CFBundleDisplayName': f'FLauncher {VERSION}',
}
)