-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_exe.py
More file actions
52 lines (43 loc) · 1.44 KB
/
build_exe.py
File metadata and controls
52 lines (43 loc) · 1.44 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
"""
Build Windows EXE
تحويل البوت لبرنامج Windows .exe
"""
import PyInstaller.__main__
import os
# إعدادات البناء
app_name = "CometX-Bot"
main_file = "main.py"
icon_file = None # يمكنك إضافة أيقونة .ico
build_args = [
main_file,
f'--name={app_name}',
'--onefile', # ملف واحد
'--windowed', # بدون نافذة console (شيل هذا السطر إذا تبي console)
'--clean',
'--noconfirm',
# إضافة الملفات المطلوبة
'--add-data=.env.example;.',
'--add-data=README.md;.',
# إضافة المكتبات المخفية
'--hidden-import=uvicorn',
'--hidden-import=fastapi',
'--hidden-import=sqlalchemy',
'--hidden-import=github',
'--hidden-import=azure.devops',
'--hidden-import=pymsteams',
'--hidden-import=httpx',
]
# إضافة أيقونة إذا موجودة
if icon_file and os.path.exists(icon_file):
build_args.append(f'--icon={icon_file}')
print("🔨 بناء البرنامج...")
print("=" * 60)
PyInstaller.__main__.run(build_args)
print("=" * 60)
print(f"✅ تم البناء بنجاح!")
print(f"📁 البرنامج موجود في: dist/{app_name}.exe")
print("=" * 60)
print("\nملاحظات:")
print("1. لا تنسى تنسخ ملف .env بجانب البرنامج")
print("2. البرنامج يحتاج Python runtime")
print("3. تأكد من التوكنات قبل التوزيع")