From 322e9ddcf363622ad36ad969b602b5d432239c0f Mon Sep 17 00:00:00 2001
From: Joel Grunbaum <joelgrun@gmail.com>
Date: Sun, 08 Feb 2026 00:08:42 +0000
Subject: [PATCH] Rename final binary not to conflict with existing archbuild

---
 tests/integration_test.py |   31 +++++++++++++++++++++++++------
 1 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/tests/integration_test.py b/tests/integration_test.py
index cad5ccc..b5f98cd 100644
--- a/tests/integration_test.py
+++ b/tests/integration_test.py
@@ -47,9 +47,10 @@
 class IntegrationTest:
     """Integration test runner."""
 
-    def __init__(self, keep_temp: bool = False, use_cli: bool = False):
+    def __init__(self, keep_temp: bool = False, use_cli: bool = False, use_binary: bool = False):
         self.keep_temp = keep_temp
         self.use_cli = use_cli
+        self.use_binary = use_binary
         self.temp_dir: Path | None = None
         self.config: Config | None = None
         self.config_path: Path | None = None
@@ -62,10 +63,19 @@
             raise RuntimeError("Config path not set")
 
         env = os.environ.copy()
-        # Add src to PYTHONPATH so the CLI can find the package
-        env["PYTHONPATH"] = str(Path(__file__).parent.parent / "src")
         
-        cmd = [sys.executable, "-m", "archbuild.cli", "-c", str(self.config_path), command] + list(args)
+        if self.use_binary:
+            binary_path = Path(__file__).parent.parent / "dist" / "archrepobuild"
+            if not binary_path.exists():
+                raise RuntimeError(f"Binary not found at {binary_path}. Run scripts/build_binary.py first.")
+            
+            cmd = [str(binary_path), "-c", str(self.config_path), command] + list(args)
+            # No PYTHONPATH needed for the standalone binary
+        else:
+            # Add src to PYTHONPATH so the CLI can find the package
+            env["PYTHONPATH"] = str(Path(__file__).parent.parent / "src")
+            cmd = [sys.executable, "-m", "archbuild.cli", "-c", str(self.config_path), command] + list(args)
+            
         return subprocess.run(cmd, capture_output=True, text=True, env=env)
 
     def setup(self) -> None:
@@ -345,7 +355,12 @@
 
     async def run(self) -> bool:
         """Run all integration tests."""
-        mode_str = " (CLI Mode)" if self.use_cli else " (Python Mode)"
+        mode_str = " (Python Mode)"
+        if self.use_binary:
+            mode_str = " (Binary Mode)"
+        elif self.use_cli:
+            mode_str = " (CLI Mode)"
+            
         console.print("[bold magenta]╔════════════════════════════════════════════╗[/]")
         console.print(f"[bold magenta]║     Archbuild Integration Test Suite{mode_str:<10}║[/]")
         console.print("[bold magenta]╚════════════════════════════════════════════╝[/]")
@@ -401,6 +416,10 @@
     """Main entry point."""
     keep_temp = "--keep-temp" in sys.argv
     use_cli = "--use-cli" in sys.argv
+    use_binary = "--use-binary" in sys.argv
+
+    if use_binary:
+        use_cli = True  # Binary mode is a sub-mode of CLI mode
 
     # Check if running on Arch Linux
     if not Path("/etc/arch-release").exists():
@@ -414,7 +433,7 @@
             console.print(f"[red]Required tool not found: {tool}[/]")
             return 1
 
-    test = IntegrationTest(keep_temp=keep_temp, use_cli=use_cli)
+    test = IntegrationTest(keep_temp=keep_temp, use_cli=use_cli, use_binary=use_binary)
     success = await test.run()
 
     return 0 if success else 1

--
Gitblit v1.10.0