This repository was archived by the owner on Nov 10, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup_environment.py
More file actions
203 lines (167 loc) · 5.95 KB
/
setup_environment.py
File metadata and controls
203 lines (167 loc) · 5.95 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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
"""
MASTER LAUNCHER ULTIMATE - Environment Setup
Commander Bobby Don McWilliams II - Authority Level 11.0
Automatically sets up the complete environment for Master Launcher Ultimate.
"""
import os
import sys
import subprocess
from pathlib import Path
# Color codes for output
GREEN = '\033[92m'
RED = '\033[91m'
YELLOW = '\033[93m'
BLUE = '\033[94m'
RESET = '\033[0m'
def print_header():
"""Print the setup header"""
print(f"\n{BLUE}{'='*80}{RESET}")
print(f"{GREEN}🎖️ MASTER LAUNCHER ULTIMATE - ENVIRONMENT SETUP{RESET}")
print(f"{BLUE}{'='*80}{RESET}\n")
def check_python():
"""Check Python installation"""
print(f"{BLUE}🔍 Checking Python...{RESET}")
python_path = r"H:\Tools\python.exe"
if not os.path.exists(python_path):
print(f"{RED}❌ Python not found at {python_path}{RESET}")
return False
try:
result = subprocess.run([python_path, "--version"],
capture_output=True, text=True)
version = result.stdout.strip()
print(f"{GREEN}✅ {version}{RESET}")
return True
except Exception as e:
print(f"{RED}❌ Error checking Python: {e}{RESET}")
return False
def create_directories():
"""Create all required directories"""
print(f"\n{BLUE}📁 Creating directories...{RESET}")
directories = [
"E:/ECHO_XV4/MLS/logs",
"E:/ECHO_XV4/MLS/backups",
"E:/ECHO_XV4/MLS/quarantine",
"E:/ECHO_XV4/MLS/databases",
"E:/ECHO_XV4/AUDIO/VOICE_CACHE"
]
for directory in directories:
try:
Path(directory).mkdir(parents=True, exist_ok=True)
print(f"{GREEN}✅ {directory}{RESET}")
except Exception as e:
print(f"{RED}❌ Failed to create {directory}: {e}{RESET}")
return False
return True
def install_dependencies():
"""Install Python dependencies"""
print(f"\n{BLUE}📦 Installing dependencies...{RESET}")
python_path = r"H:\Tools\python.exe"
try:
result = subprocess.run(
[python_path, "-m", "pip", "install", "-r", "requirements.txt"],
capture_output=True,
text=True
)
if result.returncode == 0:
print(f"{GREEN}✅ All dependencies installed{RESET}")
return True
else:
print(f"{RED}❌ Failed to install dependencies{RESET}")
print(result.stderr)
return False
except Exception as e:
print(f"{RED}❌ Error installing dependencies: {e}{RESET}")
return False
def verify_config():
"""Verify config.yaml exists and is valid"""
print(f"\n{BLUE}⚙️ Verifying configuration...{RESET}")
if not os.path.exists("config.yaml"):
print(f"{RED}❌ config.yaml not found{RESET}")
return False
try:
import yaml
with open("config.yaml", 'r') as f:
config = yaml.safe_load(f)
print(f"{GREEN}✅ Configuration valid{RESET}")
return True
except Exception as e:
print(f"{RED}❌ Error reading config.yaml: {e}{RESET}")
return False
def verify_modules():
"""Verify all Python modules exist"""
print(f"\n{BLUE}📚 Verifying modules...{RESET}")
modules = [
"authentication",
"voice",
"core",
"discovery",
"gui",
"integrations",
"monitoring"
]
for module in modules:
if os.path.exists(module) and os.path.exists(f"{module}/__init__.py"):
print(f"{GREEN}✅ {module}{RESET}")
else:
print(f"{RED}❌ {module} missing or incomplete{RESET}")
return False
return True
def create_launch_shortcuts():
"""Create convenient launch shortcuts"""
print(f"\n{BLUE}🔗 Creating launch shortcuts...{RESET}")
# LAUNCH.bat already exists
if os.path.exists("LAUNCH.bat"):
print(f"{GREEN}✅ LAUNCH.bat exists{RESET}")
# Create a quick status check script
quick_status = """@echo off
echo ===============================================
echo MASTER LAUNCHER ULTIMATE - QUICK STATUS
echo ===============================================
echo.
H:\\Tools\\python.exe quick_status.py
pause
"""
try:
with open("STATUS.bat", 'w') as f:
f.write(quick_status)
print(f"{GREEN}✅ STATUS.bat created{RESET}")
return True
except Exception as e:
print(f"{YELLOW}⚠️ Could not create STATUS.bat: {e}{RESET}")
return True # Non-critical
def print_summary(checks):
"""Print setup summary"""
print(f"\n{BLUE}{'='*80}{RESET}")
print(f"{GREEN}📊 SETUP SUMMARY{RESET}")
print(f"{BLUE}{'='*80}{RESET}\n")
total = len(checks)
passed = sum(1 for check in checks.values() if check)
for check_name, status in checks.items():
status_icon = f"{GREEN}✅{RESET}" if status else f"{RED}❌{RESET}"
print(f"{status_icon} {check_name}")
print(f"\n{BLUE}Result: {passed}/{total} checks passed{RESET}\n")
if passed == total:
print(f"{GREEN}🎉 ENVIRONMENT SETUP COMPLETE!{RESET}")
print(f"\n{YELLOW}To launch Master Launcher Ultimate:{RESET}")
print(f" 1. Run: LAUNCH.bat")
print(f" 2. Or: H:\\Tools\\python.exe master_launcher.py\n")
return True
else:
print(f"{RED}⚠️ SETUP INCOMPLETE{RESET}")
print(f"{YELLOW}Please fix the failed checks above{RESET}\n")
return False
def main():
"""Main setup routine"""
print_header()
checks = {
"Python Installation": check_python(),
"Directory Structure": create_directories(),
"Dependencies": install_dependencies(),
"Configuration": verify_config(),
"Python Modules": verify_modules(),
"Launch Shortcuts": create_launch_shortcuts()
}
success = print_summary(checks)
return 0 if success else 1
if __name__ == "__main__":
sys.exit(main())