fix: add missing main.py script and update Windows workflow

This commit is contained in:
Admin9705
2025-05-19 15:52:08 -04:00
parent 55ced08445
commit 7314d134e6
2 changed files with 56 additions and 2 deletions

View File

@@ -63,7 +63,8 @@ jobs:
- name: Build with PyInstaller
run: |
pyinstaller distribution/windows/huntarr.spec --noconfirm
# Use the dedicated build script from the distribution directory
python distribution/windows/main.py --exe-only
- name: Download Inno Setup
run: |
@@ -87,7 +88,8 @@ jobs:
run: |
$env:PATH += ";C:\Program Files (x86)\Inno Setup 6"
mkdir -p installer
ISCC.exe distribution/windows/installer/huntarr_installer.iss /Q
# Use the dedicated build script for installer creation
python distribution/windows/main.py --installer-only
- name: Create Release
if: startsWith(github.ref, 'refs/tags/')

View File

@@ -0,0 +1,52 @@
#!/usr/bin/env python3
"""
Windows Build Script for Huntarr
This script is the main entry point for building Windows packages
"""
import os
import sys
import argparse
from pathlib import Path
# Add the parent directory to the path so we can import the build module
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
# Try to import the build module
try:
from build import build_exe, build_installer, clean
except ImportError:
print("Error: Could not import build module. Make sure it's in the same directory.")
sys.exit(1)
def main():
"""Main entry point for Windows build script"""
parser = argparse.ArgumentParser(
description="Build Huntarr for Windows",
epilog="Example: python main.py --exe-only"
)
parser.add_argument("--clean", action="store_true", help="Clean up build artifacts")
parser.add_argument("--exe-only", action="store_true", help="Build only the executable, not the installer")
parser.add_argument("--installer-only", action="store_true", help="Build only the installer, assuming executable is already built")
args = parser.parse_args()
if args.clean:
clean()
if not (args.exe_only or args.installer_only):
return 0
if args.installer_only:
build_installer()
elif args.exe_only:
build_exe()
else:
# Build both
if build_exe():
build_installer()
return 0
if __name__ == "__main__":
sys.exit(main())