|
37 | 37 |
|
38 | 38 | echo "voxd installed. Each user should run: voxd --setup" |
39 | 39 |
|
40 | | -# Audio tip: suggest Pulse/ALSA plugins if 'pulse' input is missing |
41 | | -if command -v python >/dev/null 2>&1; then |
42 | | - if ! python - <<'PY' 2>/dev/null; then |
43 | | - exit 0 |
44 | | - fi |
45 | | -import sys |
46 | | -try: |
47 | | - import sounddevice as sd # type: ignore |
48 | | - names = [str(d.get('name','')).lower() for d in sd.query_devices()] |
49 | | - has_pulse = any('pulse' in n for n in names) |
50 | | - if not has_pulse: |
51 | | - print('[voxd] Tip: No "pulse" device detected. Install your distro\'s pulse shim and ALSA plugins:') |
52 | | - print(' - Debian/Ubuntu: sudo apt install alsa-plugins pavucontrol (ensure pulseaudio or pipewire-pulse active)') |
53 | | - print(' - Fedora/openSUSE: sudo dnf install alsa-plugins-pulseaudio pavucontrol (ensure pipewire-pulseaudio active)') |
54 | | - print(' - Arch: sudo pacman -S alsa-plugins pipewire-pulse pavucontrol') |
55 | | -except Exception: |
56 | | - pass |
57 | | -PY |
58 | | -fi |
59 | | - |
60 | 40 | # Create a local virtualenv to ensure missing Python deps (e.g., sounddevice) are available |
61 | 41 | # We inherit system site-packages to avoid duplicating distro Python libs |
62 | 42 | APPDIR="/opt/voxd" |
@@ -100,7 +80,7 @@ if [ -n "$PY" ]; then |
100 | 80 | # Upgrade pip quietly; then install minimal extras that may be missing from repos |
101 | 81 | "$VPY" -m pip install --upgrade --disable-pip-version-check pip >/dev/null 2>&1 || true |
102 | 82 | # Ensure core runtime dependencies inside app venv (covers Leap mismatches) |
103 | | - "$VPY" -m pip install --disable-pip-version-check --no-input sounddevice>=0.5 psutil numpy requests pyyaml tqdm pyperclip >/dev/null 2>&1 || true |
| 83 | + "$VPY" -m pip install --disable-pip-version-check --no-input "sounddevice>=0.5" psutil numpy requests pyyaml tqdm pyperclip >/dev/null 2>&1 || true |
104 | 84 | # Ensure platformdirs (imported by voxd.core.config); install only if missing |
105 | 85 | "$VPY" - <<'PY' 2>/dev/null || "$VPY" -m pip install --disable-pip-version-check --no-input platformdirs >/dev/null 2>&1 || true |
106 | 86 | try: |
|
132 | 112 | fi |
133 | 113 | fi |
134 | 114 |
|
| 115 | +# Audio tip: suggest Pulse/ALSA plugins if 'pulse' input is missing |
| 116 | +# Prefer venv Python if available; else fall back to a system Python |
| 117 | +AUDIO_PY="" |
| 118 | +if [ -x "$APPDIR/.venv/bin/python" ]; then |
| 119 | + AUDIO_PY="$APPDIR/.venv/bin/python" |
| 120 | +elif [ -n "${PY:-}" ]; then |
| 121 | + AUDIO_PY="$PY" |
| 122 | +elif command -v python3 >/dev/null 2>&1; then |
| 123 | + AUDIO_PY="python3" |
| 124 | +elif command -v python >/dev/null 2>&1; then |
| 125 | + AUDIO_PY="python" |
| 126 | +fi |
| 127 | +if [ -n "$AUDIO_PY" ]; then |
| 128 | + "$AUDIO_PY" - <<'PY' 2>/dev/null || true |
| 129 | +import sys |
| 130 | +try: |
| 131 | + import sounddevice as sd # type: ignore |
| 132 | + names = [str(d.get('name','')).lower() for d in sd.query_devices()] |
| 133 | + has_pulse = any('pulse' in n for n in names) |
| 134 | + if not has_pulse: |
| 135 | + print('[voxd] Tip: No "pulse" device detected. Install your distro\'s pulse shim and ALSA plugins:') |
| 136 | + print(' - Debian/Ubuntu: sudo apt install alsa-plugins pavucontrol (ensure pulseaudio or pipewire-pulse active)') |
| 137 | + print(' - Fedora/openSUSE: sudo dnf install alsa-plugins-pulseaudio pavucontrol (ensure pipewire-pulseaudio active)') |
| 138 | + print(' - Arch: sudo pacman -S alsa-plugins pipewire-pulse pavucontrol') |
| 139 | +except Exception: |
| 140 | + pass |
| 141 | +PY |
| 142 | +fi |
| 143 | + |
135 | 144 |
|
0 commit comments