Skip to content

Commit

Permalink
Upgrade B9-Robot for 22.04 compatibility.
Browse files Browse the repository at this point in the history
Yes, really... for something so simple a new release is required for
each new operating system.  How screwed-up is that?  At least now I
understand Snap and FlatPak, because the alternative can be bonkers.
  • Loading branch information
MadMartian committed Sep 26, 2023
1 parent b433f3a commit 81159d7
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 20 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
# B9 Robot - Overview
A configurable Python daemon that dictates system notification messages audibly exclusive to Linux operating systems.
A configurable Python daemon that dictates system notification messages audibly exclusive to Linux operating systems. This has been tested in Ubuntu 20.04 and 22.04.

## Prerequisites
1. Festival speech engine
2. Python 3.6
2. ~~Python 3.6~~ *Python v10 is now supported*
3. Pip
4. VirtualEnv
5. All other dependencies are recorded in `requirements.txt`. To install run `pip -r requirements.txt` from the repository root.

# Install
There is an install script that has been tested on Ubuntu 20.04 (Focal). For other distributions I'm afraid you're on your own.
There is an install script that has been tested on Ubuntu 20.04 (Focal) and 22.04 (Jammy). For other distributions I'm afraid you're on your own, I am not remotely responsible for the absolute mess that modern dependency management has become.

## Rant
I wasn't prepared for the absolute dependency hell that Python has become and I am still shocked that a custom install script is necessary for something so simple. This is my first (and last) Python project I will invest time in. Nobody has time for playing endless games of depedency whack-a-mole.
I wasn't prepared for the absolute dependency hell that Python has become and I am still shocked that a custom install script is necessary for something so simple. What really gets me is that I have only ever heard a handful of engineers call out this disaster trainwreck of dependency management that modern software engineering has become. Nobody has time for playing endless games of dependency whack-a-mole, where's your divine discontent?

It's a bit overkill installing *OpenCV* just to check if the video camera is turned-on, but I want to use abstractions to avoid platform-dependent behaviour. I suppose, if I get really annoyed, I'll just call `lsof /dev/video%d` from Python and be done with it.

# Configuration
To configure this daemon see the sample configuration file enclosed in this repository. Place the configuration file at `/etc/b9robot/mappings.yaml` even if that means moving and renaming the bundled `mappings.example.yaml`. You can edit this configuration and send the _hang-up_ (`HUP`) signal to b9robot to automatically reload the configuration upon receipt of the next notification.
Expand Down
4 changes: 2 additions & 2 deletions b9robot.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

import gi

Expand Down Expand Up @@ -422,7 +422,7 @@ def str_to_time_tuple(string: AnyStr):
return x.tm_hour, x.tm_min

with open('/etc/b9robot/mappings.yaml') as f:
docs = yaml.load_all(f)
docs = yaml.safe_load_all(f)

for doc in docs:
name = doc.get('name')
Expand Down
14 changes: 11 additions & 3 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
#!/bin/sh -e

sudo apt -y install libsm6 libxrender1 libfontconfig1 python3.6-dev
apt -y install libsm6 libxrender1 libfontconfig1 libxslt1-dev
cd `dirname $0`
virtualenv --python `which python3.6` .
virtualenv --python `which python3` .
. bin/activate
pip install -r requirements.txt
sed -i -e '1iimport _festival' -e '1,6{/^try:$/,/^[[:space:]]*import _festival/{d}}' lib/python3.6/site-packages/festival.py
[ -d lib/python3.6/site-packages/festival.py ] && sed -i -e '1iimport _festival' -e '1,6{/^try:$/,/^[[:space:]]*import _festival/{d}}' lib/python3.6/site-packages/festival.py

mkdir -p /etc/b9robot/
cp logging.conf /etc/b9robot/
chmod go+rX -R /etc/b9robot/

cp b9robot.py /usr/local/bin/
cp b9robot.service /lib/systemd/user/
systemctl --user enable b9robot
22 changes: 11 additions & 11 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
PyYAML == 5.3.1
beautifulsoup4 == 4.9.3
lxml == 4.6.2
cronyo == 0.4.2
dbus-python == 1.2.16
opencv-python-headless == 4.4.0.42
opencv-python-headless >= 4.4.0.42, < 4.8.0
PyYAML >= 5.3.1
beautifulsoup4 >= 4.9.3
lxml >= 4.6.2
cronyo >= 0.4.2
dbus-python >= 1.2.16
git+https://github.com/techiaith/pyfestival#festival
pygobject == 3.38.0
xlib == 0.21
html5lib == 1.1
systemd-python == 234
playsound == 1.3.0
pygobject >= 3.38.0
xlib >= 0.21
html5lib >= 1.1
systemd-python >= 234
playsound >= 1.3.0

0 comments on commit 81159d7

Please sign in to comment.