Skip to content

Commit

Permalink
feat: add linux build script
Browse files Browse the repository at this point in the history
  • Loading branch information
jessielw committed Feb 15, 2024
1 parent 8bc0ea7 commit 428a75e
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions build_linux.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
from pathlib import Path
from subprocess import run
import os


def build_app():
# define and create pyinstaller output path
pyinstaller_folder = Path(Path(__file__).parent / "pyinstaller_build")
pyinstaller_folder.mkdir(exist_ok=True)

# define paths before changing directory
script = Path(Path.cwd() / "autoqpf-cli.py")
icon_path = Path(Path.cwd() / "autoqpf.ico")

# change directory so we output all of pyinstallers files in it's own folder
os.chdir(pyinstaller_folder)

# run pyinstaller command
build_job = run(
[
"pyinstaller",
"-n",
"autoqpf-cli",
"--onefile",
f"--icon={str(icon_path)}",
str(script),
]
)

# ensure output of exe
success = "Did not complete successfully"
if (
Path(Path("dist") / "autoqpf-cli").is_file()
and str(build_job.returncode) == "0"
):
success = f'\nSuccess!\nPath to executable: {str(Path.cwd() / (Path(Path("dist") / "autoqpf-cli")))}'

# change directory back to original directory
os.chdir(script.parent)

# return success message
return success


if __name__ == "__main__":
build = build_app()
print(build)

0 comments on commit 428a75e

Please sign in to comment.