-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuilder_utils.py
More file actions
34 lines (29 loc) · 1.06 KB
/
builder_utils.py
File metadata and controls
34 lines (29 loc) · 1.06 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
import subprocess
import zipfile
import os
import sys
import shlex
def install_libs(libs):
for lib in libs: # For each library
print(f"Installing {lib}...") # Display the current library to install
if lib == "simpleaudio":
subprocess.run([sys.executable, "-m", "pip", "install", "-U", "--force", "git+https://github.com/cexen/py-simple-audio.git"])
else:
subprocess.run([sys.executable, "-m", "pip", "install", "-U", lib]) # Installs the library
def compile(compiler, flags):
flags_splitted = shlex.split(flags)
subprocess.run([compiler, *flags_splitted])
def packageExec(zipfilepath):
try:
os.makedirs("output")
except:
pass
os.chdir("dist")
zip = zipfile.ZipFile(zipfilepath, "w", zipfile.ZIP_DEFLATED) # Zips the file
zip.write("PTSaveFileEditor.exe")
zip.close()
if __name__ == "__main__": # IN case the builder doesn't get invoked
import builder
print("Builder.py not invoked! Installing neccesary libs...")
install_libs(builder.libs)
print("Done!")