-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart.py
47 lines (39 loc) · 1.41 KB
/
start.py
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
import os
import subprocess
import sys
import venv
def create_virtual_env():
env_dir = os.path.join(os.getcwd(), ".builder_env")
if not os.path.exists(env_dir):
print("Creating virtual environment...")
builder = venv.EnvBuilder(with_pip=True)
builder.create(env_dir)
# Get pip and python paths
if sys.platform == "win32":
python_path = os.path.join(env_dir, "Scripts", "python.exe")
pip_path = os.path.join(env_dir, "Scripts", "pip.exe")
else:
python_path = os.path.join(env_dir, "bin", "python")
pip_path = os.path.join(env_dir, "bin", "pip")
# Install required dependencies for the builder
dependencies = [
"PyQt6",
"psutil",
"pyinstaller",
"qtawesome"
]
print("Installing builder dependencies...")
for dep in dependencies:
subprocess.check_call([pip_path, "install", dep])
print("Virtual environment setup complete!")
return env_dir
def launch_app(env_dir):
if sys.platform == "win32":
python_path = os.path.join(env_dir, "Scripts", "python.exe")
else:
python_path = os.path.join(env_dir, "bin", "python")
# Launch app.py
subprocess.run([python_path, "app.py"])
if __name__ == "__main__":
env_dir = create_virtual_env()
launch_app(env_dir)