Add build system for native applications

- PyInstaller spec file for cross-platform builds
- Build scripts for Linux/macOS (build.sh) and Windows (build.bat)
- requirements.txt with all dependencies
- Updated README with build and installation instructions
- Support for creating standalone executables for all platforms

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-06 08:37:23 -07:00
parent 80a249edcc
commit 8005a53b48
6 changed files with 238 additions and 2 deletions

View File

@@ -0,0 +1,9 @@
{
"permissions": {
"allow": [
"Bash(python:*)"
],
"deny": [],
"ask": []
}
}

View File

@@ -26,6 +26,17 @@ A Python GUI application for generating and playing interactive word search puzz
## Installation
### Option 1: Download Pre-built Application (Recommended)
Download the pre-built application for your platform from the releases page:
- **Windows**: `WordSearch.exe`
- **macOS**: `WordSearch.app`
- **Linux**: `WordSearch` (executable)
No installation required - just download and run!
### Option 2: Run from Source
1. Clone the repository:
```bash
git clone https://git.firebugit.com/ksmith/WordSearch.git
@@ -34,12 +45,19 @@ cd WordSearch
2. Install required dependencies:
```bash
pip install reportlab
pip install -r requirements.txt
```
## Usage
Run the application:
### Running the Application
**From pre-built executable:**
- **Windows**: Double-click `WordSearch.exe`
- **macOS**: Double-click `WordSearch.app` or run `open WordSearch.app`
- **Linux**: Run `./WordSearch` from terminal
**From source:**
```bash
python word_search_generator.py
```
@@ -86,6 +104,48 @@ python word_search_generator.py
- ReportLab for PDF generation
- Event-driven architecture for mouse interactions
## Building from Source
To create standalone executables for distribution:
### Prerequisites
Install build dependencies:
```bash
pip install -r requirements.txt
```
### Building
**Linux/macOS:**
```bash
./build.sh
```
**Windows:**
```cmd
build.bat
```
The built application will be in the `dist/` directory:
- **Linux**: `dist/WordSearch`
- **macOS**: `dist/WordSearch.app`
- **Windows**: `dist/WordSearch.exe`
### Manual Build
You can also build manually using PyInstaller:
```bash
pyinstaller word_search.spec
```
### Cross-Platform Notes
- PyInstaller creates platform-specific executables
- Build on the target platform (Windows build requires Windows, etc.)
- macOS builds create an `.app` bundle
- Linux/Windows builds create a single executable file
## License
Created by Keith Smith

44
build.bat Normal file
View File

@@ -0,0 +1,44 @@
@echo off
REM Build script for Word Search application (Windows)
echo =========================================
echo Word Search Application Builder
echo =========================================
echo.
REM Check if PyInstaller is installed
pyinstaller --version >nul 2>&1
if %errorlevel% neq 0 (
echo PyInstaller not found. Installing dependencies...
pip install -r requirements.txt
)
REM Clean previous builds
echo Cleaning previous builds...
if exist build rmdir /s /q build
if exist dist rmdir /s /q dist
echo Building for platform: Windows
echo.
REM Build the application
echo Running PyInstaller...
pyinstaller word_search.spec
REM Check if build was successful
if exist dist (
echo.
echo =========================================
echo Build completed successfully!
echo =========================================
echo.
echo Platform: Windows
echo Output location: dist\
echo Executable: dist\WordSearch.exe
echo.
echo To run: dist\WordSearch.exe
) else (
echo.
echo Build failed! Check the error messages above.
exit /b 1
)

70
build.sh Executable file
View File

@@ -0,0 +1,70 @@
#!/bin/bash
# Build script for Word Search application
# This script builds the application for the current platform
echo "========================================="
echo "Word Search Application Builder"
echo "========================================="
echo ""
# Check if PyInstaller is installed
if ! command -v pyinstaller &> /dev/null; then
echo "PyInstaller not found. Installing dependencies..."
pip install -r requirements.txt
fi
# Clean previous builds
echo "Cleaning previous builds..."
rm -rf build dist
# Detect platform
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
PLATFORM="Linux"
OUTPUT_NAME="WordSearch"
elif [[ "$OSTYPE" == "darwin"* ]]; then
PLATFORM="macOS"
OUTPUT_NAME="WordSearch.app"
elif [[ "$OSTYPE" == "msys" ]] || [[ "$OSTYPE" == "cygwin" ]] || [[ "$OSTYPE" == "win32" ]]; then
PLATFORM="Windows"
OUTPUT_NAME="WordSearch.exe"
else
PLATFORM="Unknown"
OUTPUT_NAME="WordSearch"
fi
echo "Building for platform: $PLATFORM"
echo ""
# Build the application
echo "Running PyInstaller..."
pyinstaller word_search.spec
# Check if build was successful
if [ -d "dist" ]; then
echo ""
echo "========================================="
echo "Build completed successfully!"
echo "========================================="
echo ""
echo "Platform: $PLATFORM"
echo "Output location: dist/"
if [[ "$PLATFORM" == "macOS" ]]; then
echo "Application: dist/WordSearch.app"
echo ""
echo "To run: open dist/WordSearch.app"
elif [[ "$PLATFORM" == "Linux" ]]; then
echo "Executable: dist/WordSearch"
echo ""
echo "To run: ./dist/WordSearch"
chmod +x dist/WordSearch
else
echo "Executable: dist/WordSearch.exe"
echo ""
echo "To run: dist\\WordSearch.exe"
fi
else
echo ""
echo "Build failed! Check the error messages above."
exit 1
fi

2
requirements.txt Normal file
View File

@@ -0,0 +1,2 @@
reportlab>=4.0.0
pyinstaller>=6.0.0

51
word_search.spec Normal file
View File

@@ -0,0 +1,51 @@
# -*- mode: python ; coding: utf-8 -*-
block_cipher = None
a = Analysis(
['word_search_generator.py'],
pathex=[],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False,
)
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
exe = EXE(
pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name='WordSearch',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=False, # No console window
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
)
# macOS app bundle
app = BUNDLE(
exe,
name='WordSearch.app',
icon=None,
bundle_identifier='com.firebugit.wordsearch',
)