From 7314d134e6996fd2dc37b6e79715981c585f5951 Mon Sep 17 00:00:00 2001 From: Admin9705 <9705@duck.com> Date: Mon, 19 May 2025 15:52:08 -0400 Subject: [PATCH] fix: add missing main.py script and update Windows workflow --- .github/workflows/windows-installer.yml | 6 ++- distribution/windows/main.py | 52 +++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 distribution/windows/main.py diff --git a/.github/workflows/windows-installer.yml b/.github/workflows/windows-installer.yml index 234857d7..a6d75c3d 100644 --- a/.github/workflows/windows-installer.yml +++ b/.github/workflows/windows-installer.yml @@ -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/') diff --git a/distribution/windows/main.py b/distribution/windows/main.py new file mode 100644 index 00000000..4b18762d --- /dev/null +++ b/distribution/windows/main.py @@ -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())