Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build and release workflows #90

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ jobs:
run: |
pip install -r requirements.txt
pip install pyinstaller
python3 helper_scripts/package_windows.py
pyinstaller helper_scripts/win.spec
python helper_scripts/package_windows.py

- name: Rename and Compress Executable
run: |
Expand Down
50 changes: 45 additions & 5 deletions helper_scripts/package_windows.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,55 @@
import os

import sys
import subprocess

try:
import PyInstaller

if PyInstaller:
print("PyInstaller is good to go!")
print("PyInstaller is good to go!")
except ModuleNotFoundError:
raise Exception(
"You need pyinstaller installed. Make sure to install a version at least 2 months old as to avoid false positives on virus detectors. Use pip install pyinstaller."
)

os.chdir("src")
os.system("pyinstaller ../helper_scripts/win.spec")
# Get the absolute path of the script
script_dir = os.path.dirname(os.path.abspath(__file__))
print(f"Script directory: {script_dir}")

# Find the correct paths
project_root = os.path.dirname(os.path.dirname(script_dir))
ngaihan marked this conversation as resolved.
Show resolved Hide resolved
src_path = os.path.join(project_root, "src")
spec_path = os.path.join(script_dir, "win.spec")

print(f"Project root: {project_root}")
ngaihan marked this conversation as resolved.
Show resolved Hide resolved
print(f"Src path: {src_path}")
print(f"Spec file path: {spec_path}")

# Verify paths exist
if not os.path.exists(src_path):
print(f"Error: src directory not found at {src_path}")
sys.exit(1)

if not os.path.exists(spec_path):
print(f"Error: spec file not found at {spec_path}")
sys.exit(1)

# Change to the src directory
try:
os.chdir(src_path)
print(f"Changed working directory to: {src_path}")
except Exception as e:
mak448a marked this conversation as resolved.
Show resolved Hide resolved
print(f"Error changing directory: {e}")
sys.exit(1)

# Use subprocess instead of os.system for better error handling
try:
result = subprocess.run(
["pyinstaller", spec_path], capture_output=True, text=True, check=True
)
print("PyInstaller command executed successfully")
print(result.stdout)
except subprocess.CalledProcessError as e:
print(f"PyInstaller command failed with error: {e}")
print(f"Standard output: {e.stdout}")
print(f"Standard error: {e.stderr}")
sys.exit(1)
38 changes: 0 additions & 38 deletions main.spec
mak448a marked this conversation as resolved.
Outdated
Show resolved Hide resolved

This file was deleted.

44 changes: 0 additions & 44 deletions package_mac.spec
mak448a marked this conversation as resolved.
Outdated
Show resolved Hide resolved

This file was deleted.

44 changes: 0 additions & 44 deletions package_windows.spec
mak448a marked this conversation as resolved.
Outdated
Show resolved Hide resolved

This file was deleted.