45 lines
909 B
Python
45 lines
909 B
Python
#!/usr/bin/env python3
|
|
|
|
import os
|
|
import subprocess
|
|
import sys
|
|
|
|
import PyInstaller.__main__
|
|
|
|
# ARGS
|
|
workspaceFolder = sys.argv[1]
|
|
|
|
pyExe = sys.executable
|
|
pyFolder = os.path.split(pyExe)[0]
|
|
|
|
# TRANSFORMATION
|
|
for file in os.listdir(workspaceFolder):
|
|
if file.endswith(".spec"):
|
|
specFile = os.path.join(workspaceFolder, file)
|
|
print(f"## SPEC-FILE: {specFile}")
|
|
break
|
|
else:
|
|
exit(1)
|
|
|
|
|
|
# COMMAND GENERATOR
|
|
def cmd_setup():
|
|
cmd = []
|
|
cmd.append(pyExe)
|
|
cmd.append("setup.py")
|
|
cmd.append("build")
|
|
return cmd
|
|
|
|
|
|
def cmd_pyinstaller():
|
|
cmd = []
|
|
cmd.append("--clean")
|
|
cmd.append(specFile)
|
|
return cmd
|
|
|
|
|
|
if __name__ == "__main__":
|
|
print("\n## RUN SETUP BUILD")
|
|
subprocess.check_call(cmd_setup(), cwd=workspaceFolder)
|
|
print("\n## RUN PYINSTALLER BUILD")
|
|
PyInstaller.__main__.run(cmd_pyinstaller())
|