-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuilder.py
More file actions
39 lines (31 loc) · 1.45 KB
/
builder.py
File metadata and controls
39 lines (31 loc) · 1.45 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
import os
import subprocess
import zipfile
import shutil
from builder_utils import *
"""Compiler options"""
compiler = "pyinstaller" # Compiler
compiler_flags = '--onefile --windowed src/main.py --name="PTSaveFileEditor.exe" --clean --noupx ' \
'--version-file=version.txt --add-data="src/audio/crash.wav;."' # Compiler flags, version.txt to bypass retarded AVs, mf i have AVs now
libs = ["dearpygui", compiler, "easygui", "pydub", "audioop-lts", "simpleaudio", "pymsgbox", "pyperclip", "requests"] # Required libraries
def main():
os.chdir(os.path.dirname(os.path.realpath(__file__))) # Enters the current directory where the builder is found, this fixes the "Script file 'src/main.py' does not exist." error when compiling
try:
shutil.rmtree("dist")
shutil.rmtree("output")
except:
pass
print("Step 1/3: installing required libs")
install_libs(libs)
print("Finished installing libs")
print("Step 2/3: Compiling program")
print(f"Compiler of choice: {compiler}") # Shows the compiler that is going to be used
print(f"Compiler flags: {compiler_flags}") # Shows the compiler flags
print(f"Building with the following command:\n{compiler} {compiler_flags}")
compile(compiler, compiler_flags)
print("Step 3/3: Zipping program")
zipfilepath = f"../output/PTSaveFileEditor.zip"
packageExec(zipfilepath)
print("Done! Check for any errors")
if __name__ == "__main__":
main()