-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.py
More file actions
61 lines (51 loc) · 1.53 KB
/
build.py
File metadata and controls
61 lines (51 loc) · 1.53 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
import subprocess
import sys
import os
def run_command(cmd, description):
print(f"\n{'='*60}")
print(f"▶ {description}")
print(f"{'='*60}")
result = subprocess.run(cmd, shell=True)
if result.returncode != 0:
print(f"✗ Ошибка при выполнении: {description}")
sys.exit(1)
print(f"✓ {description} завершено")
script_dir = os.path.dirname(os.path.abspath(__file__))
os.chdir(script_dir)
# Установка зависимостей
run_command(
f"{sys.executable} -m pip install --upgrade pip",
"Обновление pip"
)
run_command(
f"{sys.executable} -m pip install -r requirements.txt",
"Установка зависимостей из requirements.txt"
)
run_command(
f"{sys.executable} -m pip install pyinstaller",
"Установка PyInstaller"
)
# Сборка с PyInstaller
print(f"\n{'='*60}")
print("▶ Сборка приложения с PyInstaller")
print(f"{'='*60}")
result = subprocess.run([
sys.executable, '-m', 'PyInstaller',
'--onefile',
'--windowed',
'--name=SimpleChatbox',
'--distpath=./dist',
'--workpath=./build',
'--specpath=./build',
'main.py'
])
if result.returncode == 0:
print(f"\n{'='*60}")
print("✓ Сборка успешно завершена!")
print(f"✓ Exe находится в: ./dist/SimpleChatbox.exe")
print(f"{'='*60}\n")
else:
print(f"\n{'='*60}")
print("✗ Ошибка при сборке")
print(f"{'='*60}\n")
sys.exit(result.returncode)