From a4c5cdc4f68d4091a4d1984ad1ee1b32e3d4109e Mon Sep 17 00:00:00 2001 From: goodroot Date: Sat, 6 Sep 2025 16:03:35 -0700 Subject: [PATCH] Fix launcher script to use venv python directly - Replace activate script sourcing with direct venv python usage - This avoids hardcoded build paths in activate script - Bump pkgrel to 7 --- .SRCINFO | 2 +- PKGBUILD | 27 ++++++++++++++++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/.SRCINFO b/.SRCINFO index b651999d4190..766b19b7f265 100644 --- a/.SRCINFO +++ b/.SRCINFO @@ -1,7 +1,7 @@ pkgbase = hyprwhspr pkgdesc = Native Whisper speech-to-text for Arch/Omarchy with Waybar integration pkgver = 1.2.0 - pkgrel = 6 + pkgrel = 7 url = https://github.com/goodroot/hyprwhspr install = hyprwhspr.install arch = x86_64 diff --git a/PKGBUILD b/PKGBUILD index b58f3a762f61..150ffc885f6e 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -2,7 +2,7 @@ pkgname=hyprwhspr pkgver=1.2.0 -pkgrel=3 +pkgrel=4 pkgdesc="Native Whisper speech-to-text for Arch/Omarchy with Waybar integration" arch=('x86_64') url="https://github.com/goodroot/hyprwhspr" @@ -52,6 +52,31 @@ package() { chmod +x "${pkgdir}/opt/${pkgname}/scripts/"*.sh chmod +x "${pkgdir}/opt/${pkgname}/bin/hyprwhspr" + # Fix the launcher script to use venv python directly + cat > "${pkgdir}/opt/${pkgname}/bin/hyprwhspr" << 'EOF' +#!/bin/bash + +# HyprWhspr - Hyprland-optimized voice dictation application +# Main launcher script + +# Get the directory where this script is located +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +PACKAGE_ROOT="$(dirname "$SCRIPT_DIR")" + +# Set environment variables +export HYPRWHSPR_ROOT="$PACKAGE_ROOT" +export PYTHONPATH="$PACKAGE_ROOT/lib:$PYTHONPATH" + +# Use virtual environment's python directly if it exists +if [ -f "$PACKAGE_ROOT/venv/bin/python" ]; then + exec "$PACKAGE_ROOT/venv/bin/python" "$PACKAGE_ROOT/lib/main.py" "$@" +else + # Fallback to system python + exec python3 "$PACKAGE_ROOT/lib/main.py" "$@" +fi +EOF + chmod +x "${pkgdir}/opt/${pkgname}/bin/hyprwhspr" + # Create Python virtual environment and install pip-only dependencies cd "${pkgdir}/opt/${pkgname}" python -m venv venv