From f7c40d48c0727a96843c85990cc36ae5a9ac6888 Mon Sep 17 00:00:00 2001
From: Joel Grunbaum <joelgrun@gmail.com>
Date: Sat, 07 Feb 2026 23:42:43 +0000
Subject: [PATCH] Add integration test for binary

---
 scripts/build_binary.py |   60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 60 insertions(+), 0 deletions(-)

diff --git a/scripts/build_binary.py b/scripts/build_binary.py
new file mode 100644
index 0000000..c5eccf7
--- /dev/null
+++ b/scripts/build_binary.py
@@ -0,0 +1,60 @@
+#!/usr/bin/env python3
+"""
+Script to build a standalone executable for archbuild using PyInstaller.
+"""
+
+import subprocess
+import sys
+import os
+import shutil
+from pathlib import Path
+
+def build():
+    print("Building standalone executable...")
+    
+    # Ensure pyinstaller is installed
+    try:
+        import PyInstaller
+    except ImportError:
+        print("PyInstaller not found. Installing...")
+        subprocess.run([sys.executable, "-m", "pip", "install", "pyinstaller"], check=True)
+
+    # Path to the source root
+    root = Path(__file__).parent.parent
+    src = root / "src"
+    
+    # Create a temporary entry script
+    entry_script = root / "archbuild_entry.py"
+    entry_script.write_text("from archbuild.cli import main\nif __name__ == '__main__':\n    main()\n")
+
+    # PyInstaller command
+    pyinstaller_exe = shutil.which("pyinstaller")
+    if pyinstaller_exe:
+        cmd = [pyinstaller_exe]
+    else:
+        cmd = [sys.executable, "-m", "PyInstaller"]
+
+    cmd += [
+        "--onefile",
+        "--name", "archbuild-bin",
+        "--paths", str(src),
+        "--clean",
+        "--collect-all", "archbuild",
+        "--collect-all", "rich",
+        str(entry_script)
+    ]
+    
+    print(f"Running: {' '.join(cmd)}")
+    try:
+        result = subprocess.run(cmd, cwd=root)
+        if result.returncode == 0:
+            print("\nSuccessfully built executable: dist/archbuild-bin")
+        else:
+            print("\nBuild failed!")
+            sys.exit(result.returncode)
+    finally:
+        if entry_script.exists():
+            entry_script.unlink()
+
+if __name__ == "__main__":
+    build()

--
Gitblit v1.10.0