-
Notifications
You must be signed in to change notification settings - Fork 0
/
generateWindowsClient.py
38 lines (31 loc) · 1.06 KB
/
generateWindowsClient.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
import subprocess
import os
def generate_executable():
# Define the path to the client script
client_script = 'client.py'
# Check if the client script exists
if not os.path.exists(client_script):
print(f"Error: {client_script} does not exist.")
return
# Define the command to run PyInstaller
command = [
'pyinstaller',
'--onefile',
'--noconfirm',
'--clean',
client_script
]
# Execute the command
print("Generating executable using PyInstaller...")
result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
# Check if the build was successful
if result.returncode == 0:
print("Build completed successfully.")
print("Executable can be found in the 'dist' directory.")
print("Move the client.exe file to the target machine for execution.")
else:
print("Build failed with errors:")
print(result.stdout)
print(result.stderr)
if __name__ == "__main__":
generate_executable()