Skip to content

Commit dfda85d

Browse files
committed
build script
1 parent 95a506e commit dfda85d

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

build.py renamed to zzbuild.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,16 @@ def parse_arguments():
1919
def run_command(command, shell=False, env=None):
2020
if isinstance(command, str):
2121
command = command.split()
22+
print(f"Running command: {' '.join(command)}")
23+
if env:
24+
print(f"Environment: {env}")
25+
2226
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=shell, env=env)
2327
output, error = process.communicate()
2428
if process.returncode != 0:
2529
print(f"Error executing command: {' '.join(command)}")
26-
print(error.decode())
30+
print(f"Output: {output.decode()}")
31+
print(f"Error: {error.decode()}")
2732
exit(1)
2833
return output.decode()
2934

@@ -35,6 +40,13 @@ def get_pip_path(venv_path):
3540
return os.path.join(venv_path, "bin", "pip")
3641

3742

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+
3850
def setup_environment(skip_venv=False):
3951
venv_path = os.path.join(os.getcwd(), "buildvenv")
4052

@@ -62,6 +74,7 @@ def activate_venv(venv_path):
6274

6375
# Modify the PATH to prioritize the virtual environment
6476
os.environ["PATH"] = os.pathsep.join([
77+
os.path.join(venv_path, "Scripts"),
6578
os.path.join(venv_path, "bin"),
6679
os.environ.get("PATH", "")
6780
])
@@ -84,8 +97,10 @@ def build_project(venv_path):
8497
print("Installing PyInstaller..")
8598
run_command([pip_path, "install", "pyinstaller"])
8699

100+
pyinstaller_path = get_pyinstaller_path(venv_path)
101+
87102
print("Building executable..")
88-
run_command(["pyinstaller", "build.spec"])
103+
run_command([pyinstaller_path, "build.spec"])
89104

90105

91106
def copy_assets():

0 commit comments

Comments
 (0)