@@ -19,11 +19,16 @@ def parse_arguments():
19
19
def run_command (command , shell = False , env = None ):
20
20
if isinstance (command , str ):
21
21
command = command .split ()
22
+ print (f"Running command: { ' ' .join (command )} " )
23
+ if env :
24
+ print (f"Environment: { env } " )
25
+
22
26
process = subprocess .Popen (command , stdout = subprocess .PIPE , stderr = subprocess .PIPE , shell = shell , env = env )
23
27
output , error = process .communicate ()
24
28
if process .returncode != 0 :
25
29
print (f"Error executing command: { ' ' .join (command )} " )
26
- print (error .decode ())
30
+ print (f"Output: { output .decode ()} " )
31
+ print (f"Error: { error .decode ()} " )
27
32
exit (1 )
28
33
return output .decode ()
29
34
@@ -35,6 +40,13 @@ def get_pip_path(venv_path):
35
40
return os .path .join (venv_path , "bin" , "pip" )
36
41
37
42
43
+ def get_pyinstaller_path (venv_path ):
44
+ if platform .system () == "Windows" :
45
+ return os .path .join (venv_path , "Scripts" , "pyinstaller.exe" )
46
+ else :
47
+ return os .path .join (venv_path , "bin" , "pyinstaller" )
48
+
49
+
38
50
def setup_environment (skip_venv = False ):
39
51
venv_path = os .path .join (os .getcwd (), "buildvenv" )
40
52
@@ -62,6 +74,7 @@ def activate_venv(venv_path):
62
74
63
75
# Modify the PATH to prioritize the virtual environment
64
76
os .environ ["PATH" ] = os .pathsep .join ([
77
+ os .path .join (venv_path , "Scripts" ),
65
78
os .path .join (venv_path , "bin" ),
66
79
os .environ .get ("PATH" , "" )
67
80
])
@@ -84,8 +97,10 @@ def build_project(venv_path):
84
97
print ("Installing PyInstaller.." )
85
98
run_command ([pip_path , "install" , "pyinstaller" ])
86
99
100
+ pyinstaller_path = get_pyinstaller_path (venv_path )
101
+
87
102
print ("Building executable.." )
88
- run_command (["pyinstaller" , "build.spec" ])
103
+ run_command ([pyinstaller_path , "build.spec" ])
89
104
90
105
91
106
def copy_assets ():
0 commit comments