Skip to content

Doubao-powered voice input for Linux, Wayland and Omarchy

fix(debian): install runtime dependencies through apt

quanrub72582435ff9
diff --git a/debian/changelog b/debian/changelog
index 4b6797b..4fa6552 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+doubao-say (1.2.0-1) noble; urgency=medium
+
+ * Install Python runtime dependencies through apt, with no pip invocation
+ from postinst. Use system Python and PipeWire for audio capture.
+
+ -- doubao-say contributors <[email protected]> Wed, 23 Sep 2026 12:00:00 +0800
+
doubao-say (1.0.2-1) noble; urgency=medium
* Logo: replaced white-backed assets with transparent-background
diff --git a/debian/control b/debian/control
index b023f64..5e04ad8 100644
--- a/debian/control
+++ b/debian/control
@@ -13,16 +13,16 @@ Architecture: all
Depends:
${misc:Depends},
python3-gi,
+ python3-cairo,
+ python3-websockets,
+ python3-evdev,
gir1.2-gtk-4.0,
gir1.2-webkit-6.0,
libgtk-4-1,
libwebkitgtk-6.0-4,
- wl-clipboard
-Recommends:
- python3-pip,
- python3-venv
+ wl-clipboard,
+ pipewire-bin
Suggests:
- python3-numpy,
xclip,
xdotool
Description: Doubao Say voice input for Linux desktops
@@ -30,9 +30,6 @@ Description: Doubao Say voice input for Linux desktops
into the focused input field. Backed by Doubao's streaming ASR.
.
This package installs the Python application, a systemd --user service
- for auto-start, and a postinst hook that:
- * adds the installing user to the 'input' group so /dev/input/event*
- and /dev/uinput are reachable without sudo, and
- * creates a user-level venv at ~/.local/share/doubao-say/.venv
- containing the pure-Python deps (websockets, sounddevice, evdev),
- because those are not in Ubuntu's apt repos for python3-* .
+ for auto-start. The postinst hook adds the installing user to the 'input'
+ group so /dev/input/event* and /dev/uinput are reachable without sudo.
+ Python dependencies are installed from the distribution repository.
diff --git a/debian/postinst b/debian/postinst
index 27e3c81..1310fcb 100755
--- a/debian/postinst
+++ b/debian/postinst
@@ -3,17 +3,12 @@
#
# - Add the installing user to the 'input' group so they can read
# /dev/input/event* (evdev) and write /dev/uinput without sudo.
-# - Create a per-user Python venv at
-# ~/.local/share/doubao-say/.venv with the pure-Python deps
-# (websockets, sounddevice, evdev). These are not in Ubuntu's
-# apt repos so we install them via pip into the user venv.
# - Print a friendly summary.
set -e
USER_NAME="${SUDO_USER:-${USER:-}}"
GROUP="input"
-VENV_DIR_REL=".local/share/doubao-say/.venv"
case "$1" in
configure)
@@ -36,32 +31,7 @@ case "$1" in
fi
fi
- # ---- 2. user-level venv with pip-only deps ----
- if [ -n "$USER_NAME" ] && [ "$USER_NAME" != "root" ] && \
- command -v python3 >/dev/null 2>&1 && \
- [ -x /usr/bin/python3 ]; then
- USER_HOME=$(getent passwd "$USER_NAME" | cut -d: -f6)
- if [ -n "$USER_HOME" ] && [ -d "$USER_HOME" ]; then
- VENV_DIR="$USER_HOME/$VENV_DIR_REL"
- mkdir -p "$(dirname "$VENV_DIR")"
- chown "$USER_NAME":"$USER_NAME" "$(dirname "$VENV_DIR")" 2>/dev/null || true
- if [ ! -x "$VENV_DIR/bin/python3" ]; then
- echo "doubao-say postinst: 为用户 $USER_NAME 创建 venv ($VENV_DIR)..."
- su -s /bin/sh "$USER_NAME" -c \
- "python3 -m venv '$VENV_DIR' --system-site-packages" \
- 2>/dev/null || true
- su -s /bin/sh "$USER_NAME" -c \
- "'$VENV_DIR/bin/pip' install --quiet --upgrade pip && \
- '$VENV_DIR/bin/pip' install --quiet websockets sounddevice evdev numpy" \
- 2>/dev/null || true
- echo " ✓ venv 就绪。"
- else
- echo "doubao-say postinst: venv 已存在 ($VENV_DIR)。"
- fi
- fi
- fi
-
- # ---- 3. reload user's systemd manager ----
+ # ---- 2. reload user's systemd manager ----
if command -v systemctl >/dev/null 2>&1 && \
[ -n "$USER_NAME" ] && [ "$USER_NAME" != "root" ]; then
USER_UID=$(id -u "$USER_NAME" 2>/dev/null || true)
@@ -90,4 +60,4 @@ esac
#DEBHELPER#
-exit 0
\ No newline at end of file
+exit 0
diff --git a/debian/rules b/debian/rules
index 4c45cc0..d6dc443 100755
--- a/debian/rules
+++ b/debian/rules
@@ -30,15 +30,7 @@ override_dh_auto_install:
printf '%s\n' \
'#!/bin/sh' \
'# Wrapper for the doubao-say voice IME.' \
- '# Pure-Python deps (websockets, sounddevice, evdev) live in' \
- '# the per-user venv at ~/.local/share/doubao-say/.venv' \
- '# (created by postinst); system Python provides gi / Gtk / WebKit.' \
- 'VENV="$$HOME/.local/share/doubao-say/.venv"' \
- 'if [ -x "$$VENV/bin/python3" ]; then' \
- ' exec "$$VENV/bin/python3" -m doubao_input "$$@"' \
- 'else' \
- ' exec python3 -m doubao_input "$$@"' \
- 'fi' \
+ 'exec /usr/bin/python3 -m doubao_input "$$@"' \
> debian/doubao-say/usr/bin/doubao-say
chmod 0755 debian/doubao-say/usr/bin/doubao-say
diff --git a/packaging/build-deb.sh b/packaging/build-deb.sh
index 88e821a..ae99db2 100755
--- a/packaging/build-deb.sh
+++ b/packaging/build-deb.sh
@@ -4,7 +4,7 @@
# Requires (on the build host):
# sudo apt install build-essential debhelper dh-python \
# python3-all python3-setuptools python3-pip \
-# python3-websockets python3-sounddevice python3-evdev
+# python3-installer
#
# Usage:
# ./packaging/build-deb.sh # builds ../doubao-say_1.2.0-1_all.deb
diff --git a/src/doubao_input/preflight.py b/src/doubao_input/preflight.py
index 4e98a2b..0b9b997 100644
--- a/src/doubao_input/preflight.py
+++ b/src/doubao_input/preflight.py
@@ -8,7 +8,9 @@ from doubao_input.desktop import is_x11
def check_runtime():
- return {**check_system(), **_check_modules(("evdev", "websockets", "sounddevice"))}
+ # pw-record is required by check_system() and provides native capture.
+ # sounddevice is only an optional PortAudio fallback.
+ return {**check_system(), **_check_modules(("evdev", "websockets"))}
def _check_modules(modules):
diff --git a/tests/contracts/test_debian_package.py b/tests/contracts/test_debian_package.py
new file mode 100644
index 0000000..4d4a742
--- /dev/null
+++ b/tests/contracts/test_debian_package.py
@@ -0,0 +1,28 @@
+"""Guard the Debian install path against fetching executable Python packages."""
+from pathlib import Path
+import unittest
+from unittest.mock import patch
+
+from doubao_input import preflight
+
+
+ROOT = Path(__file__).resolve().parents[2]
+
+
+class DebianPackageTest(unittest.TestCase):
+ def test_pipewire_runtime_does_not_require_portaudio(self):
+ with patch.object(preflight, "check_system", return_value={"pw-record": True}), \
+ patch.object(preflight, "_check_modules", return_value={"evdev": True, "websockets": True}) as modules:
+ self.assertTrue(all(preflight.check_runtime().values()))
+ modules.assert_called_once_with(("evdev", "websockets"))
+
+ def test_runtime_dependencies_are_distribution_packages(self):
+ control = (ROOT / "debian/control").read_text()
+ postinst = (ROOT / "debian/postinst").read_text()
+ rules = (ROOT / "debian/rules").read_text()
+
+ for package in ("python3-websockets", "python3-evdev", "pipewire-bin"):
+ self.assertIn(package, control)
+ self.assertNotIn("pip", postinst)
+ self.assertNotIn("venv", postinst)
+ self.assertIn("exec /usr/bin/python3 -m doubao_input", rules)
diff --git a/tests/unit/test_desktop.py b/tests/unit/test_desktop.py
index f6f3287..eec2c20 100644
--- a/tests/unit/test_desktop.py
+++ b/tests/unit/test_desktop.py
@@ -57,6 +57,7 @@ class DesktopTest(TestCase):
self.assertTrue(all(optional.values()))
self.assertNotIn("evdev", results)
self.assertIn("evdev", preflight.check_runtime())
+ self.assertNotIn("sounddevice", preflight.check_runtime())
def test_missing_x11_tool_is_optional_and_reported(self):
with patch.dict(os.environ, SESSIONS[0][0], clear=True), \