From 275460da89e74ac70ce127215753a44e40f17f1a Mon Sep 17 00:00:00 2001
From: Joel Grunbaum <joelgrun@gmail.com>
Date: Sat, 07 Feb 2026 23:28:25 +0000
Subject: [PATCH] Add script to build an executable
---
scripts/build_binary.py | 53 ++++++++++++++++++++++++++
README.md | 25 ++++++++++--
2 files changed, 74 insertions(+), 4 deletions(-)
diff --git a/README.md b/README.md
index 1ddf3f5..dd87bde 100644
--- a/README.md
+++ b/README.md
@@ -16,14 +16,31 @@
## Installation
+### From Source
```bash
-# From source
-pip install -e .
+# Clone the repository
+git clone https://github.com/joelgrun/archbuild
+cd archbuild
-# Or with development dependencies
-pip install -e ".[dev]"
+# Set up virtual environment and install
+python -m venv .venv
+source .venv/bin/activate
+pip install -e .
```
+### Native Arch Linux Package
+To build and install as a native system package:
+```bash
+makepkg -si
+```
+
+### Standalone Binary
+To create a standalone executable that doesn't require Python:
+```bash
+python scripts/build_binary.py
+```
+The binary will be available at `dist/archbuild-bin`.
+
## Quick Start
1. **Create configuration**:
diff --git a/scripts/build_binary.py b/scripts/build_binary.py
new file mode 100644
index 0000000..f56d6c9
--- /dev/null
+++ b/scripts/build_binary.py
@@ -0,0 +1,53 @@
+#!/usr/bin/env python3
+"""
+Script to build a standalone executable for archbuild using PyInstaller.
+"""
+
+import subprocess
+import sys
+import os
+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
+ cmd = [
+ "pyinstaller",
+ "--onefile",
+ "--name", "archbuild-bin",
+ "--paths", str(src),
+ "--clean",
+ "--collect-all", "archbuild",
+ 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