-
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathbuild_simple.py
More file actions
94 lines (82 loc) · 2.88 KB
/
build_simple.py
File metadata and controls
94 lines (82 loc) · 2.88 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
#!/usr/bin/env python3
"""
Simple build script for ForexSmartBot
Creates a standalone executable using PyInstaller
"""
import os
import sys
import subprocess
import shutil
from pathlib import Path
def run_command(cmd):
"""Run a command and return the result."""
try:
result = subprocess.run(cmd, shell=True, capture_output=True, text=True)
if result.returncode != 0:
print(f"Error running command: {cmd}")
print(f"Error: {result.stderr}")
return False
print(f"Success: {cmd}")
return True
except Exception as e:
print(f"Exception running command {cmd}: {e}")
return False
def build_executable():
"""Build standalone executable using PyInstaller."""
print("Building ForexSmartBot executable...")
# Install PyInstaller if not already installed
print("Installing PyInstaller...")
if not run_command("pip install pyinstaller"):
return False
# Create the build command
cmd = [
"pyinstaller",
"--onefile",
"--windowed",
"--name=ForexSmartBot",
"--icon=assets/icons/forexsmartbot_256.ico",
"--add-data=forexsmartbot/languages;forexsmartbot/languages",
"--add-data=assets;assets",
"--hidden-import=PyQt6.QtCore",
"--hidden-import=PyQt6.QtGui",
"--hidden-import=PyQt6.QtWidgets",
"--hidden-import=matplotlib",
"--hidden-import=numpy",
"--hidden-import=pandas",
"--hidden-import=yfinance",
"--hidden-import=requests",
"--hidden-import=win10toast",
"app.py"
]
# Convert list to string for subprocess
cmd_str = " ".join(cmd)
print(f"Running: {cmd_str}")
if run_command(cmd_str):
print("✅ Executable built successfully!")
print("📁 Output: dist/ForexSmartBot.exe")
return True
else:
print("❌ Failed to build executable")
return False
def main():
"""Main build function."""
print("ForexSmartBot v3.0.0 - Simple Builder")
print("=" * 40)
# Check if we're in the right directory
if not os.path.exists("app.py"):
print("❌ Error: app.py not found. Please run this script from the project root.")
return False
if not os.path.exists("forexsmartbot"):
print("❌ Error: forexsmartbot directory not found. Please run this script from the project root.")
return False
# Build the executable
if build_executable():
print("\n🎉 Build completed successfully!")
print("📁 The executable is located in: dist/ForexSmartBot.exe")
print("🚀 You can now distribute this executable!")
return True
else:
print("\n❌ Build failed!")
return False
if __name__ == "__main__":
main()